Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Joker2002

using ReadFile()

This topic is 5555 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Having trouble using ReadFile. Pretty sure it has to do with my pointer variable. Any help appreciated.

int main(void)
{
char filename[] = "text.txt";
long *pointer = NULL;
HANDLE file_handle;

     if ((file_handle = CreateFile(filename,
                              GENERIC_READ,
                              FILE_SHARE_READ,
                              NULL,
                              OPEN_EXISTING,
                              FILE_ATTRIBUTE_NORMAL,
                              NULL)) == INVALID_HANDLE_VALUE)
   return(0);

    ReadFile(file_handle, pointer, 1, 0, NULL);
}
 
Assume text.txt has just one 8-bit character in the file. At the end of the code, pointer is always still NULL. By the way, I''ve tried just about every imaginable combination for the pointer variable type and no luck.

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!