In a word processor when you hit the key the cursor will move one line down and all the way to the left margin. That is what the '\n' character simulates in text files. When you load a text file that contains newlines in Notepad or some other word processor you will see that behavior. Remove the newlines and everything will appear on the same line.
Exactly what is put in text files depends on the operating system -- MS-Windows adds two characters to the text file while both *nix and MAC add only one character.
Ancient Dragon
Retired & Loving It
30,042 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
>>what does it mean " if variable is not '/n'?
If the '\n' character has not been encountered -- normally signifies the end of a string in text files. '\0' indicates the end of the string in memory, assuming it is a normal c-style character array.
>>and is there any other way of writing
Could be done like this:
char str[] = "01\n";
if( strchr(str,variable) != 0)
{
// found it
}
Ancient Dragon
Retired & Loving It
30,042 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341