So I have the following code:
printf("the output is: %s.\n", intCAPass);
Which prints the following:
the output is: intercapass
.
So I tried the two following options to get rid of the newline at the end of the string intCAPass
:
intCAPass[strlen(intCAPass)- 1] = '\0';
strtok(intCAPass,"\n");
but both give me the following output:
.he output is: intercapass
So I'm wondering whats going on here.
More info:
OS: Linux
The variable intCAPass
receive the string from a function that reads a file containing interca\n
. So, I use a buffer in which I copy the whole file and at the end I do buffer[len] = '\0';
and at some point I thought it could cause some problems but I don't think so.