1: "to clear the text or something" .
2: you already have the code,
3: its more fun than a cursor,
4: when you code your next game you'll have
a readymade hiScore name entry system..
Printable View
i was looking around, and i found this
strset
its suppossed to set all the letters of a text to a letter, but i don;t know how to use it.
It takes two arguments, the first is a pointer to the null terminated string, the second argument is the numerical value you wish to use to overwrite the string up to the null character.
can you give me an example??i keep getting an error
ok i decided to look around some more , i found this function
strcpy();
and it works! But is there any way to copy the character to the last letter of the destination string??
Strcpy is used for pass the data of string to other string.
Strcat is for past string in the final of another one.
It might be easier if you forgo the string functions and manage the message buffer yourself.
You could create a index that would start at message[0]. As users type letters insert that letter where the index points, then increment index. When your ready to print the string out insert a null character at the end.
You would need to make sure index never exceeds the size of the message buffer.
is there any easy way just to remove the last charecter of a string??
Inserting a null should do what you want to do.
how would i do that??
Find the end of your string using strlen, for example, then assign a null character.
int string_length = 0;
char my_string[] = {"boat"};
printf("%s\n", my_string);
/* outputs boat */
string_length = strlen(my_string);
/*string_length equals 4*/
my_string[3] = '\0';
/*insert null character at the end of the string*/
printf("%s\n", my_string);
/* outputs boa */
my_string[3] = '\0';
should be
my_string[string_length-1] = '\0';
yes i just figured that out and it WORKS!!! thank you very much!!
ok now im having ANOTHER problem, im working on the ad-hoc part, and as i have told you i was following this tutorial.
http://forums.qj.net/f-guides-develo...ial-55788.html
(right now im using the eboot of this program)it sends the size of the message correctly, but it doesn't send the actual message right. I believe that the problem is that it sends the message as void, but then it doesn't get changed to a string or something, does anyone know how to do this???