Quote:
Originally Posted by Metalgod4eva
Actually EOF does not identify the size of the file or the start of data. EOF stands for End Of File/stream and job to signal like a semicolon in C statements, that the particular data stream is finished. EOF is represented as -1 or '\o'. As a native C programmer I have never heard anyone ever mention that EOF was no longer a macro in the standard lib anymore ^ have I seen it even not been. I understand that when working with robot on partial C code that does not conform to ANSI or hides most the code in many files that you just assume that if you don’t run across EOF does not mean its not there. EOF is a macro and is used for every line of stream. AKA after every \n a -1 is placed. Think of it as more of an End OF line. http://www.cprogramming.com/faq/cgi-...wer=1048865140
In response to kitscuzz:
Char are 1 byte and 3 byte padding:
"EOF" is not a character, its -1 an int:
Name an OS does not use EOF:
When passing a string to a cam: A string is an array, there is no string support in C. So all chars are saved in ordnance of the 0th element to MAX-1 element, The MAX element is '\0' || NULL in a char array and '-1’ in and int array. /*Lets for argument sake allow NULL == EOF even though there different in the char array the eof follows null*/ That is also the reason Even if you never declared the array all the function for strings must use them, thus all strings use EOF, all arrays use EOF. Brain W. Kernighan and Dennis M. Ritchie creators of c have an ANSI Book read pages 17, 28, chapter 7 151, 242+. Have a great day!
|
For the camera thing, yes, you send individual characters to the camera. That was what I meant by "strings except to the camera,
and then you really only send the characters and the line in terminated by a \r or \n, and wait for the camera to reply appropriately." You send the characters with no \0 (but I'm not sure whether or not the \0 needs to be sent, someone more experienced should confirm that).
I did not mean to imply that the EOF represented the size of the file, I was saying that the EOF has been replaced by the size of the file.
As for what the EOF is, it is only returned, as the URL you directed me to says, by functions that are reading files or input from the terminal or another application.
- EOF (0xff 0xff) is returned by fgetc() due to end of input
You can also trigger an EOF by typing into the terminal a predefined sequence into a terminal. This is what I meant by "OS-specific" because the sequence to send the EOF to a terminal is dependent on the OS (for example on a windows system it's ctrl+z).
As you said "EOF is a macro and is used for every line of stream." But unfortunately it is only triggered when you reach the end of a stream. This will NEVER HAPPEN unless you are reading from file or terminal, and when reading from a terminal, you need to have someone type an EOF (which won't be triggered while running the robot in normal conditions).
Anyway, the point is that since we don't use files, we don't recieve an EOF. Hope that clears up any confusion.