cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Windows Programming
Detect EOF using winapi
Detect EOF using winapi
Sep 3, 2009 at 3:27pm UTC
Null
(957)
Hello, hi can i detect end of file using winapi? My program uses CreateFile() function to open files and disks.
Thanks!
Last edited on
Sep 3, 2009 at 3:27pm UTC
Sep 3, 2009 at 4:00pm UTC
webJose
(2948)
I suppose that you use ReadFile() to read the file. If so, ReadFile() + GetLastError() will signal the end of file.
From MSDN:
If the ReadFile function attempts to read past the end of the file, the function returns zero, and GetLastError returns ERROR_HANDLE_EOF.
http://msdn.microsoft.com/en-us/library/aa365467%28VS.85%29.aspx
Topic archived. No new replies allowed.