String parameter for my method/function?

Non-platform specific questions.

String parameter for my method/function?

Postby Zehper48 » Sun Jun 19, 2011 12:34 am

Code: Select all
void changeText(string newtext){

}



This is my code, i want to use a string as a parameter, but when i use this in the global code it says
Unknown type 'string': possible old C type declaration

how do i use a string as a parameter?
Thank you :)
I like score
User avatar
Zehper48
 
Posts: 241
Joined: Sun Jun 11, 2006 1:34 am
Location: Advanced Noob
Score: 4 Give a positive score

Re: String parameter for my method/function?

Postby Hblade » Sun Jun 19, 2011 12:36 am

void NewText(char *textactor, char *newtext) {
sprintf(&textactor, &newtext);
}

i think that'll work, its untested though, sorry :P

if that doesn't work change the void line to:

void NewText(char textactor[256], char newtext[256]) {
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest