Mismatched Input ' Eof ' Expecting 'block Of Statements'

EoF - "stop reading immediately after the word EoF is found in the multi-line input" As other answers have explained, the multi-line input is called a Here Document (i.e. it's a document that's being provided 'inline' or 'on the spot'). A Here Document is often used to generate output to be passed to a subsequent process.

Mismatched Input ' Eof ' Expecting 'block Of Statements' 1

50 I am a newbie in Linux admin and while I'm learning GDB to debug my code, I need to create an input.txt file for my program to read. I know redirection symbols such as >, >>, and <, but couldn't find info about << via Google since it ignores it. What does the <<EOF do below?

If you use <<-EOF, I recommend the man page of the Bourne Shell: If, however, the hyphen (-) is appended to <<: leading tabs are stripped from word before the shell input is read (but after parameter and command substitution is done on word); leading tabs are stripped from the shell input as it is read and before each line is compared with word; and shell input is read up to the first line ...

Mismatched Input ' Eof ' Expecting 'block Of Statements' 3

EOF indicates "end of file". A newline (which is what happens when you press enter) isn't the end of a file, it's the end of a line, so a newline doesn't terminate this loop. The code isn't wrong [*], it just doesn't do what you seem to expect. It reads to the end of the input, but you seem to want to read only to the end of a line. The value of EOF is -1 because it has to be different from ...

Mismatched Input ' Eof ' Expecting 'block Of Statements' 4