Questions tagged [eof]

End of file (commonly abbreviated EOF) is a condition in a computer operating system where no more data can be read from a data source.

From Wikipedia:

End of file (commonly abbreviated EOF) is a condition in a computer operating system where no more data can be read from a data source. The data source is usually called a file or stream.

EOF is also a macro defined in the <stdio.h> header of the C standard library. This macro:

expands to an integer constant expression, with type int and a negative value, that is returned by several functions to indicate end-of-file, that is, no more input from a stream;

For more information:

1831 questions
0
votes
2 answers

Shell Script EOF with variable

Hi I would like to know how to add a a regular tab I want to the store the result in a variable of executing ls -lis. AUX=`ls -lis $i` RESULT+="$AUX" I have a loop for all the files. And when I do echo $RESULT: All the information is in one line…
user3671361
  • 175
  • 4
  • 15
0
votes
0 answers

Xcode ⌃d EOF Not Working After Paste

Behavior is very inconsistent-- very frustrating. The problem must lie in pasting some input text into Xcode's Debug Area. Here's how to replicate the problem: #include /* count digits, white space, others */ main() { int c, i, nwhite,…
0
votes
4 answers

execute after EOF in C

I'm doing homework for my C programming class. The question states "Write a program which reads input as a stream of characters until encountering EOF". I'm using Xcode on my macbook and the only way I know to make the program encounter EOF is…
Dat Tran
  • 159
  • 3
  • 12
0
votes
0 answers

Python and shell issue : .sh file not entirely run by Python

I am writing a Python script, in which I create then execute a shell file. This shell file is composed of several lines, each line being a shell command (with some grep, sort, etc..). Here is an example of one of these command lines from…
Totoro
  • 97
  • 2
  • 7
0
votes
1 answer

How to continue reading from stdin after Control-D on OS/X

I would like to use EOF to terminate reading bulk user input, but continue to be able to accept user CLI input. It seems that Linux allows this behaviour, but OS/X simply shuts down the stdin input steam (as seem from the following test program). Is…
Tzunghsing David Wong
  • 1,271
  • 14
  • 10
0
votes
1 answer

Pass here document to other script

I have a script a.sh build up an here document which looks like below read -r -d "" message << EOF line1 line2 line3 line4 EOF then I want to pass this message (which contain four lines) to another program so I did b.sh $message however in b.sh…
Linsong Guo
  • 37
  • 1
  • 1
  • 6
0
votes
2 answers

Read line in C++ till EOF

I'm writing a function that reads line by line from cin and returns when it sees ; character. #include #include #include #include using namespace std; int read_cmd(char *cmd) { cout << "Please enter…
zzxx53
  • 413
  • 3
  • 12
0
votes
1 answer

ending value of a file prints out as questionmark

I am having a problem with writing from one file to another, especially the last value, which is end of file, prints out as question mark in a black square. My code is supposed to replace text on some conditions which works perfectly just the last…
0
votes
2 answers

Dealing with EOFException in java

I have the following function. I want the loop to continue until the message equals "You have successfully logged in!". But when the user enters a wrong input (invalid username or password) then the loop goes on infinitely, because of an…
user2735714
  • 131
  • 7
0
votes
2 answers

how eof function work on cpp?

I know that function "eof" (cpp) return "True" only after wrong try to read from file (and not when i arrived to the end of file) Because of that if we want to move all the file from 1 to another we must do infile.get(c); while ( !infile.eof() ) { …
dani1999
  • 89
  • 2
  • 10
0
votes
1 answer

getchar() != EOF Loop peeking at next char

I recently overheard my professor talking about being able to do something like that. I cannot find a single method that sounds like it would do that. So my question stands. In the standard getchar while loop, how would one take a peek at the next…
TheUnknown
  • 53
  • 2
  • 10
0
votes
1 answer

Bash error: "b.sh: line 52: syntax error: unexpected end of file logout"

So, I wanted this to download a file from my computer, transfer it to my iPhone, install the file there, and respring my phone. For some reason the error you saw in the title pops up. Would be nice if someone could help, thanks. …
andrew
  • 3
  • 1
0
votes
1 answer

EOF in the middle of an input

my question is about how EOF is interpreted in the middle of an input, here is an example: int main() { int a, b; printf("enter something >\n"); scanf("%d", &a); while((b = getchar()) != EOF) { printf("%i\n", b); } return…
Mcs
  • 534
  • 1
  • 5
  • 14
0
votes
0 answers

EOF and BOF error when clicking once in listview - vb 2008

my problem is when i'm clicking a data in my listview i get that error. can anyone help me :( This is my code Public Class frmRegister Sub Clear() txtID.Text = "" txtFAN.Text = "" txtFN.Text = "" txtMI.Text = "" …
0
votes
1 answer

K&R 1-9 // using getchar in a loop inside a loop

I have this simple program: main() { int c; while ((c = getchar()) != EOF) { if (c == ' ') { while ((c = getchar()) == ' '); putchar(' '); if (c == EOF) break; } …
maja
  • 697
  • 5
  • 18