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
1 answer

Verify that the expression getchar() != EOF is 0 or 1

Problem Verify that the expression getchar() != EOF is 0 or 1. Approach I have tried to write a program which will first take an input other than EOF and thus will print the value 1. Next it will take EOF as input and will print 0. /* Program to…
In78
  • 440
  • 4
  • 17
0
votes
0 answers

Python code netcat tool

I have been working on a netcat listener written in Python, and I am having some trouble with the script continuing to read from STDIN until it receives a EOF marker. The following is example commands that I have been running: This does successfully…
richnoxin
  • 11
  • 3
0
votes
1 answer

C - fscanf raises EOF before end-of-file

I am writing a C code to read floating point numbers from a text file. The text file looks like this: 202.75 47.22 141.20 202.75 47.22 -303.96 202.75 47.22 -301.67 202.75 47.22 482.42 ... There are 19973 lines in this file and the C code snippet…
user1670806
0
votes
0 answers

While loop ends even though fscanf is not EOF

This is my first question here and I hope it is a sensible one. Here it goes: I use a very simple loop to read value from a file: int i=0; int cmp; FILE *file = fopen(file_name,"rb"); while (cmp = fscanf(file,"%f %f %f %f %f", &Gr[i], &dr[i],…
0
votes
1 answer

Saxon HE and XQuery: Unexpected token ""

I copy paste this example from http://www.w3schools.com/xquery/xquery_functions.asp (though I added the namespace declaration): declare namespace local="local"; declare function local:minPrice($p as xs:decimal?,$d as xs:decimal?) as xs:decimal? { …
Vering
  • 907
  • 9
  • 19
0
votes
1 answer

File read gets EOF before real EOF

I receive a file (*.png) via network and that file is written (in binary mode) to the HDD properly. When I try to open the file, for further manipulation, it won't load totally corrupting the lower part of the png image. This happens with several…
miguels
  • 606
  • 1
  • 7
  • 30
0
votes
0 answers

How to skip new line in EOF?

My code #include "stdafx.h" #include "library_list.h" using namespace std; library_list::library_list(string filePath){ ifstream library_read_file_pointer(filePath); string line_data_read_from_library_data_file; …
user3878349
0
votes
1 answer

Reading text file cause invalid character at buffer end

Reading a simple text file in c++ display invalid characters at the end of buffer, string filecontent=""; ifstream reader(fileName); reader.seekg (0, reader.end);`` int length = reader.tellg(); reader.seekg (0, reader.beg); …
Ali
  • 557
  • 1
  • 9
  • 30
0
votes
1 answer

Java Serializable EOF

EDITED So I'm trying to save in a .ser file objects of type Product( containing name, quantity, price ) as it follows: each time I add a new product I add it in the file. Then, each time I launch a window, I want to read these products I previously…
Lorena Sfăt
  • 215
  • 2
  • 7
  • 18
0
votes
1 answer

user login form vb6 error

hi, i write programme in vb6 and depend on ms access database i create table in ms access (users) then i make module :- Public DB As New ADODB.Connection Public RS As New ADODB.Recordset Public RSS As New ADODB.Recordset Public SQLS As…
0
votes
2 answers

Program quits while changing characters?

I am trying to make a program that converts (Đ,Š,Č,Ć and Ž) Serbian(Latin) charecters to (D,S,C,C,Z) so my TV can recnognise them btw. NO IT's NOT A ENCODING ERROR, YES MY TV IS RUNNING THE LATEST SOFTWARE. So I decided to make this command…
nik123
  • 113
  • 1
  • 2
  • 11
0
votes
1 answer

'\n' characters before EOF

char ch; int n = 0; FILE* fp; fp = fopen("test.txt", "r"); while(!feof(fp)){ n++; fscanf(fp, "%c", &ch); fprintf("%c", ch); } printf("%d\n", n); test.txt below abcd I tried to count how many time does this while loop go by printing…
Castle_Dust
  • 63
  • 1
  • 5
0
votes
4 answers

How to check EOF when reading txt file using ifstream

I want to read a text file in c++ using ifstream to know the number of words, characters, lines. unsigned int wordNum = 0; unsigned int lineNum = 0; unsigned int charNum = 0; char check; ifstream in("example_2_4.txt"); char temp[30]; if…
soonoo
  • 867
  • 1
  • 10
  • 35
0
votes
1 answer

Determining EOF expression

I need to verify that the expression getchar() ! = EOF is 0 or 1. My current code: #include int main (int argc, char *argv[]) { int c; while (( c= getchar()) != EOF) { printf("%d ", c != EOF); putchar(c); …
coder111
  • 35
  • 1
  • 4
0
votes
1 answer

How to read input from stdin until EOF read line by line with each line containing four space separated integers in C

How to read input from stdin until EOF read line by line with each line containing four space separated integers in C. It could be inputted by commands like this: $ echo 1 2 3 4 | ./myProgram or $ cat file.txt 1 2 3 4 0 -3 2 -4 $ ./myProgram <…
joshuatvernon
  • 1,530
  • 2
  • 23
  • 45