Author: Alessandro Scotti
Date: 10:58:33 09/08/04
Go up one level in this thread
On September 08, 2004 at 11:24:21, Uri Blass wrote: >1)if (strchr(input_buffer,'\r')) *strchr(input_buffer,'\r')=' '; > >What is the meaning of \r? Have you ever used one of those old mechanic typewriters? At the end of the line you had to press a lever. That would move the paper up and get ready for the next line: this is a line feed (LF). At the same time you pull the lever and the entire sheet support (i.e. the carriage) to the left, thus moving the cursor back to the beginning of the line: this is a carriage return (CR). At the beginning this mechanism had been considered useful for reproducing in software and that's why you have two separate ASCII characters: one will move the cursor to the beginning of the line, and the other to the next line. Text files that separate lines with a CRLF sequence can be sent to a dumb typewriter and will print correctly, other that use only a single CR or LF might need additional software or a smarter typewriter. Today this doesn't make much sense anymore and it's just a legacy from the past. We have CR for Mac, LF for Linux/Unix and CRLF for Windows, of the most common platforms. >It seems to me to be impossible when fgets was used to read input_buffer On the contrary, fgets() does not strip the newline characters it reads, which gets() does. >I want to have a function to understand pgn file... Yeah... that part promises to be quite boring, that's why I've delayed working at some book code so long! :-) It would be really nice to have a portable library to handle book management, or good documentation for existing book formats so that one could use existing software and maybe just write the small "probe" part... ehm... Bob? :-P
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.