From 78fde14808c0b075bd040d23b1d8cfb349c7cd84 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 20 Dec 2011 19:53:06 -0800 Subject: fix feof, plus test --- tests/files.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/files.cpp') diff --git a/tests/files.cpp b/tests/files.cpp index d692ce67..e1a38421 100644 --- a/tests/files.cpp +++ b/tests/files.cpp @@ -28,6 +28,18 @@ int main() fclose (file); free (buffer); + // Do it again, with a loop on feof + + printf("loop: "); + file = fopen("somefile.binary", "rb"); + assert(file); + while (!feof(file)) { + char c = fgetc(file); + if (c != EOF) printf("%d ", c); + } + fclose (file); + printf("\n"); + // Standard streams printf("input:%s\n", gets((char*)malloc(1024))); -- cgit v1.2.3-70-g09d2