forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Passing a char string

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Ghoti



Joined: 31 Dec 2005
Posts: 288

PostPosted: Mon Jul 03, 2006 12:22 am    Post subject: Passing a char string Reply with quote

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
View user's profile Send private message
zilt



Joined: 21 Feb 2006
Posts: 45
Location: Ontario, Canada

PostPosted: Mon Jul 03, 2006 1:00 am    Post subject: Reply with quote

How is your Sample_Load() function declared? Does it included the 'const' qualifier? ie. 'Sample_Load( const char * name )'
Back to top
View user's profile Send private message Visit poster's website
Ghoti



Joined: 31 Dec 2005
Posts: 288

PostPosted: Mon Jul 03, 2006 1:03 am    Post subject: Reply with quote

it like this:

Code:
MIKMODAPI extern SAMPLE *Sample_Load(CHAR*);

_________________
My PSP games:

Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php
Back to top
View user's profile Send private message
Ghoti



Joined: 31 Dec 2005
Posts: 288

PostPosted: Mon Jul 03, 2006 1:09 am    Post subject: Reply with quote

thanks removed the const and that did the trick :) my game crashes still however :(
_________________
My PSP games:

Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php
Back to top
View user's profile Send private message
zilt



Joined: 21 Feb 2006
Posts: 45
Location: Ontario, Canada

PostPosted: Mon Jul 03, 2006 5:02 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group