i need help,,
i have a text file like this below

Line 1
Line 2
Line 3

my question, how to readfile from that txt line by line
using Win32 API and output to console...
can anyone help me,,
i'm very new in c++

Thanks

Recommended Answers

All 2 Replies

For writing you need

DWORD nWritten;
WriteFile(hin, buff, 40, &nWritten, NULL);

And for reading you need

DWORD nRead;
ReadFile(hout, buff2, 40, &nRead, NULL);

For win32 API tutorial, check out this

win32 api has no function that reads one line at a time such as fgets() and getline() do, instead they do binary reads similar to fread() and fstream.read(). If you want to read a file in text mode then don't use win32 api functions but standard C or C++ file i/o functions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.