Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I print a .txt-file?

Status
Not open for further replies.

GabbeC

Programmer
May 14, 2002
1
SE
Good morning.
I wonder how I can print a .txt-file from my Visual C++ program.
It's a log-file that automaticly should be printed, repeatetly.

Greets GabbeC.
 
Try this, old sport:

#pragma warning(disable:4786)
#include <string>
#include <iostream>
#include <fstream>


using namespace std;

int main(int argc, char *argv[])
{

fstream in(&quot;c:\\FILENAME&quot;);

string line;
while (!in.eof())
{
getline(in, line);
cout << line;
}

in.close();

return 0;

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top