eof

What is the EOF marker for a ZIP file?

I've got a C# program that uses SharpZIPlib to decompress some zip files? It works fine but on one file, I keep getting "Unexpected EOF" error? Is there actually an EOF marker, or did the Zip file just get truncated? ...

Python Popen, closing streams and multiple processes

I have some data that I would like to gzip, uuencode and then print to standard out. What I basically have is: compressor = Popen("gzip", stdin = subprocess.PIPE, stdout = subprocess.PIPE) encoder = Popen(["uuencode", "dummy"], stdin = compressor.stdout) The way I feed data to the compressor is through compressor.stdin.write(stuff...

how does this code from "The C Programming Language" work?

I'm reading "The C Programming Language (2nd ed.) and near the beginning, it has examples like this: while((c = getchar()) != EOF) if(c == '\n'){ ++n1; I can see how this would work while reading from a file, and I understand this syntax... But this is just reading from the console--how does one signal end of file when ent...

Ruby cross-platform way to write the EOF symbol

Hey, Is there a platform-independent way of writing the EOF symbol to a string in Ruby. In *nix I believe the symbol is ^D, but in Windows is ^Z, that's why I ask. Cheers Pete ...

C : How to simulate an EOF ?

I am currently reading K&R's book and typing in the examples from the first section, and there are a couple of examples such as this: while((c = getchar()) != EOF) { //do something } I am testing these examples on a Windows box and thus running the compiled exe files from the cmd prompt. To test the example above, how do I simula...

Problem in fread and an EoF mark

For some reason, fread stoppes reading at a place in the file that contains 1A1A (raw bytes, ofcourse, not text). The file is open in "rb" mode, and it does skip 1A's, but not the double 1A. Any solution? ...

How to read input until EOF in Lisp

How do I read an input stream until EOF in Lisp? In C, you might do it like this: while ((c = getchar()) != EOF) { // Loop body... } The reason I am asking this is because I would like to be able to pipe data to my Lisp programs (I've just started learning) without having to specify the data size in advance. Here's an example f...

How do I get the ruby YAML implementation to not read beyond the YAML EOF(...)

In the YAML specification it says ... is the EOF If I do: YAML.load_documents("--- abc\n--- 42\n...\nerror") { |d| puts d } I should get abc 42 But I get abc 42 error Unfortenely there is not much documentation about the YAML parses. Do I have to tell the parses to honor the EOF, or does the parser not comply to the specs? ...

End of File in C++

Hi, I have a n X 2 matrix stored in a text file as it is. I try to read it in C++ nb_try=0; fin>>c_tmp>>gamma_tmp; while (!fin.eof( )) //if not at end of file, continue reading numbers { // store cs_bit.push_back(c_tmp); gammas_bit.push_back(gamma_tmp); nb_try++; // read fin>>c_tmp; assert(!fin.fail( )); // fail at ...

C Programming: EOF as a character

When programming C for the command console, what happens when you have a function that tries to use SCANF to ask user input for a CHAR variable, and the user types CTRL+Z (EOF) and hits enter? For example: char promptChar() { char c; printf("Enter a character: "); scanf("%c", &c); return c; } If the user types CTRL+Z ...

Infinite loop on EOF in C++

This code works as desired for the most part, which is to prompt the user for a single character, perform the associated action, prompt the user to press return, and repeat. However, when I enter ^D (EOF) at the prompt, an infinite loop occurs. I am clearing the error state via std::cin.clear() and calling std::cin.ignore(...) to clear...

Problem with EOF in C

I'm writing a program which is supposed to read two strings that can contain line breaks and various other characters. Therefore, I'm using EOF (Ctrl-Z or Ctrl-D) to end the string. This works fine with the first variable, but with the second variable, however, this seems to be problematic as apparently something is stuck in the input b...

Whitespace at end of file causing EOF check to fail in C++

I'm reading in data from a file that has three columns. For example the data will look something like: 3 START RED 4 END RED To read in the data I'm using the following check: while (iFile.peek() != EOF) { // read in column 1 // read in column 2 // read in column 3 } My problem is that the loop usually does on extra ...

How to detect EOF in awk?

Is there a way to determine whether the current line is the last line of the input stream? ...

Avoiding 'End Of File' errors

I'm trying to import a tab delimited file into a table. The issue is, SOMETIMES, the file will include an awkward record that has two "null values" and causes my program to throw a "unexpected end of file". For example, each record will have 20 fields. But the last record will have only two fields (two null values), and hence, unexpec...

Why doesn't CTRL-D send EOF in mono?

Take the following C# file, the simplest possible repro of my problem: using System; using System.IO; public static class Test { public static void Main(string[] args) { string line; while ((line = Console.In.ReadLine()) != null) { Console.Out.WriteLine(line); } } } When I build...

python stdin eof

Hi all, How to pass python eof to stdin here is my code p = Popen(commd,stdout=PIPE,stderr=PIPE,stdin=PIPE) o = p.communicate(inputstring)[0] when i run the commd in command line after i input the inputstring windows still expecting a Ctrl+Z to finish accepting input. How can I pass eof or Ctrl+Z in program? Thanks! ...

bison end of file

If i forget to put an empty line at the end of any of my files my program gets a syntax error. The problem is my grammar expects a newline to end the current line. Since a newline doesnt exist bison generates a syntax error bc it does not finish the rule. How do i solve this? I tried making <> return MY_EOF BUT when i do that lex crashe...

How to use EOF to run through a text file in C?

Hello, I have a text file that has strings on each line. I want to increment a number for each line in the text file, but when it reaches the end of the file it obviously needs to stop. I've tried doing some research on EOF, but couldn't really understand how to use it properly. I'm assuming I need a while loop, but I'm not sure how to...

C++ can native type char hold End of File character?

The title is pretty self explanatory. char c = std::cin.peek(); // sets c equal to character in stream I just realized that perhaps native type char can't hold the EOF. thanks, nmr ...