| | |
newline character
![]() |
•
•
Join Date: Sep 2007
Posts: 13
Reputation:
Solved Threads: 0
what is a newline character and what does it do?
for example, what does " variable != '\n' " mean?
And is there any other way to write" if (variable != '0' && variable != '1' && variabel != '\n') "?
I've tried " if (variable < '0' && variable > '1' && variabel != '\n') " , but it wouldn't work.
thanks
for example, what does " variable != '\n' " mean?
And is there any other way to write" if (variable != '0' && variable != '1' && variabel != '\n') "?
I've tried " if (variable < '0' && variable > '1' && variabel != '\n') " , but it wouldn't work.
thanks
Last edited by megan-smith; Sep 30th, 2007 at 7:06 pm.
In a word processor when you hit the <Enter> 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.
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Sep 2007
Posts: 13
Reputation:
Solved Threads: 0
thanks for the explanation.
now i understand what it means.
but what about " variable != '\n' " in an if command?
what does it mean " if variable is not '/n'?
and is there any other way of writing " if (variable != '0' && variable != '1' && variabel != '\n') "?
i told ya what i tried but it did not work!
thanks again.
now i understand what it means.
but what about " variable != '\n' " in an if command?
what does it mean " if variable is not '/n'?
and is there any other way of writing " if (variable != '0' && variable != '1' && variabel != '\n') "?
i told ya what i tried but it did not work!
thanks again.
>>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:
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:
C Syntax (Toggle Plain Text)
char str[] = "01\n"; if( strchr(str,variable) != 0) { // found it }
Last edited by Ancient Dragon; Sep 30th, 2007 at 9:17 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- How to insert new line character (PHP)
- How to Remove Newline character from a VB String (Visual Basic 4 / 5 / 6)
- How to insert newline character (PHP)
- New line Character in column alias (MS SQL)
Other Threads in the C Forum
- Previous Thread: changing values of a struct
- Next Thread: Help!!!!!!!!!!!!!
| Thread Tools | Search this Thread |
#include adobe api array arrays asterisks binarysearch calculate char cm copyanyfile copyimagefile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush fgets file fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators initialization kernel kilometer km linked linkedlist linux linuxsegmentationfault list lists locate logical_drives loopinsideloop. match matrix meter microsoft motherboard mqqueue mysql number odf open opensource openwebfoundation owf pattern pdf performance pointer pointers posix power probleminc process program programming pyramidusingturboccodes read recursion recv repetition research scanf scheduling scripting segmentationfault send shape socket socketprograming socketprogramming stack standard string systemcall unix user voidmain() wab win32api windows.h






