Note: File I/O in binary mode makes no translation. Upon writing a file (or stdout), the reverse translation occurs. In file I/O, in text mode, upon reading the bytes of the input file (and stdin), depending on the environment, when bytes with the value(s) of 10 (Unix), 13,10, (*1) (Windows), 13 (Old Mac?) and other variations are translated in to a '\n'. If ASCII is used, this char would have the value of 10. In source code, the 2 characters \ and n represent the char new-line as \n. This new-line typically marks the end of a line of source code (actually a bit more complicated here), // comment, and # directives. Had the source code been in another character set, different codes may be used. In that case, codes 10, sometimes 13, and sometimes paired 13,10 as new-line for source code. Many compilers will treat source text as ASCII. This C new-line comes up in 3 places: C source code, as a single char and as an end-of-line in file I/O when in text mode. The new-line may be thought of a some char and it has the value of '\n'. What is the newline character in the C language: \r or \n?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |