Handling files in C ++

// **********************************************
// archiv03.cpp
// Demonstrates file read operations
// © 1999, Jaime Virgilio Gómez Negrete
// **********************************************

#include <fstream.h>

int main ()
{
ifstream file (“Tests.txt”, ios :: noreplace);
char line [128];
long counter = 0L;

if (file.fail ())
close << “Error when opening the file Tests.txt” << endl;
else
while (! file.eof ())
{
file.getline (line, sizeof (line));
cout << line << endl;
if ((% counter% 24) == 0)
{
cout << “CONTINUE …”;
cin.get ();
}
}
file.close ();
return 0;
}

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!