⠠⠍⠥⠓⠁⠍⠍⠁⠙⠽⠥⠎⠥⠋
did you mean end of file?
Bruce
Yess
BinaryByter
What is EOF(end of function) and how it is used in c language
EOF typically refers to "end of file"
BinaryByter
it means - like what it sounds like - that you have read everything that is in the file
Bruce
Can u explain briefly
BinaryByter
think of it like the last page in a book
BinaryByter
Can u explain briefly
there is nothing more to it
⠠⠍⠥⠓⠁⠍⠍⠁⠙⠽⠥⠎⠥⠋
Bruce
In 16bit machine size of short int is 2bytes,size of int is also 2bytes,so what is difference in using any one?
BinaryByter
well there are machines that have more than just 2 bytes
BinaryByter
on x86_64, an int is typically 4 bytes long
BinaryByter
while a short is just 2 bytes (I think) long
BinaryByter
if you want to be sure about the size of your datatype, use uint128_t etc
BinaryByter
is it true that Valu6 if EOF is -1 ?
it isn't really a value in that sense
BinaryByter
its just a signal
BinaryByter
that signal is indeed usually reported by having a -1
BinaryByter
but you could also throw an exception for end of file
BinaryByter
valid way to transport the signal ¯\_(ツ)_/¯
BinaryByter
"ey, man you are done reading your book. guess i'll blow up your house"
BinaryByter
someone correct me if i'm blatantly wrong
Bruce
well there are machines that have more than just 2 bytes
So,in 16bit they both doesn't make any difference,is it?
BinaryByter
its just that the compiler decides how to implement them
Mitesh
what is this 26?
BinaryByter
Oh
BinaryByter
this is the end of file bit
BinaryByter
TIL
BinaryByter
this is an ASCII character
BinaryByter
Mitesh
EOF is -1 or 26 ??
BinaryByter
actuzally its probably 25
BinaryByter
EOF is -1 or 26 ??
-1 is what the function you read returns
Mitesh
and what is meaning bif 26(SUB) ?
BinaryByter
26 is substitute
BinaryByter
it probably had meaning but now it vanished
BinaryByter
anyway, the byte your (bad) book is referring to is 25
BinaryByter
So the idea is that you read
BinaryByter
until you see that byte
BinaryByter
ascii contains control bytes and character bytes
Bruce
No
What is difference then in applying
Mitesh
what is meaning of ASCII 25 ?
and difference between -1(EOF ) and 25?
BinaryByter
What is difference then in applying
The difference is a real problem for programmers
BinaryByter
because we can't be sure about how much space our variables will have
BinaryByter
and difference between -1(EOF ) and 25?
this could be your end of file function: char endOfFile () { if (currentChar == 25) return -1; return 0; }
BinaryByter
Good :D
Mitesh
Thank you very much 😁😊👍👍👍
BinaryByter
Oh?
S.
Back in the old days, when you used tape to store data, you have many files on a tape, with each of which ended with EOF -- and End of Medium, was for the whole tape.
BinaryByter
Oh okay
BinaryByter
which one was the EOF bit?
BinaryByter
maybe ETX
BinaryByter
or FS
S.
=,= sorry I don't know the detail
BinaryByter
don't worry ;)
S.
☺️
BinaryByter
I can't find an EOF bit in the ASCII table
BinaryByter
maybe in the ansi table
S.
https://wiki.zmanda.com/index.php/Tape_Driver_Semantics
BinaryByter
ansi isnt a character set 🤦‍♂️
BinaryByter
https://wiki.zmanda.com/index.php/Tape_Driver_Semantics
yea, tape drives used file separator bytes
Mitesh
I can't find an EOF bit in the ASCII table
EOF can't be in Ascii table because as per you have said EOF is Signal
BinaryByter
yes
BinaryByter
but in the file, theres something that says "end of file"
BinaryByter
and I just assumed that there is a character that is called end of file
BinaryByter
well, I thought so
BinaryByter
but ... i have a doubt
BinaryByter
yea