my_string[3] = '\0';
should be
my_string[string_length-1] = '\0';
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???
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks