I am writing C code for a class. This class requires our code to compile and run on the school server, which is a machine with a solarium. I am running Linux x64.
I have this line for parsing (THIS IS NOT ACTUAL CODE, BUT ENTERING MY PROGRAM):
while ( cond1 ){
I need to write "while" and "cond1" on separate lines. I used strtok()for this. On Linux, the following lines:
char *cond = NULL;
cond = (char *)malloc(sizeof(char));
memset(cond, 0, sizeof(char));
strcpy(cond, strtok(NULL, ": \t\(){"));
will fix the string "cond1" correctly. However, this on a Solaris machine gives me the string "cone1".
Please note that in many other cases in my program the lines are copied correctly. (For example, "while") was committed correctly.
Does anyone know what is going on here?