| View previous topic :: View next topic |
| Author |
Message |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
Posted: Mon Jul 03, 2006 12:22 am Post subject: Passing a char string |
|
|
hi folks,
I'm trying to pass a char string to a function i do it like i always do but suddenly it gives warnings it may be the function to which i pass the string but i do not know for certain.
my code: | Code: | int SoundLoad(int i, const char *sMsg){
switch(i) {
case 1: {
Sound1 = Sample_Load(sMsg);
break;
}
case 2: {
Sound2 = Sample_Load(sMsg);
break;
}
case 3: {
Sound3 = Sample_Load(sMsg);
break;
}
}
return i;
} |
and these are the warnings i get:
| Code: | ghtSound.c: In functie 'SoundLoad':
ghtSound.c:48: let op: passing argument 1 of 'Sample_Load' discards qualifiers from pointer target type
ghtSound.c:52: let op: passing argument 1 of 'Sample_Load' discards qualifiers from pointer target type
ghtSound.c:56: let op: passing argument 1 of 'Sample_Load' discards qualifiers from pointer target type | I can get it to run but then my game crashes when i want to play a sound.
any ideas? _________________ My PSP games:
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php |
|
| Back to top |
|
 |
zilt
Joined: 21 Feb 2006 Posts: 45 Location: Ontario, Canada
|
Posted: Mon Jul 03, 2006 1:00 am Post subject: |
|
|
| How is your Sample_Load() function declared? Does it included the 'const' qualifier? ie. 'Sample_Load( const char * name )' |
|
| Back to top |
|
 |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
|
| Back to top |
|
 |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
|
| Back to top |
|
 |
zilt
Joined: 21 Feb 2006 Posts: 45 Location: Ontario, Canada
|
Posted: Mon Jul 03, 2006 5:02 am Post subject: |
|
|
| My answer was only for the compile warnings - it wouldn't cause your game to crash. Can't help you with the crash. Check the return value from Sample_Load() - is it valid? If you don't play a sound, does it still crash? You have to narrow down the cause of the crash more. |
|
| Back to top |
|
 |
|