file i/o

This is a discussion on file i/o within the Windows Programming forums, part of the Platform Specific Boards category; hello good people can someone plz give an example (if poss wit a brief explanation) on how to work with ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    9

    file i/o

    hello good people

    can someone plz give an example (if poss wit a brief explanation)
    on how to work with the funtions CreateFile, WriteFile, ReadFile.
    i'm a bit mixed up with the arguments.
    thanks in advance for your kind time

    1976

    "The truth is an amusing concept"

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    22
    Here's what I got for CreateFile and ReadFile

    Unsigned Char Buffer[50]={0};
    HANDLE hFile;
    DWORD ReadBytes = 16;
    DWORD dwRead;


    hFile= CreateFile("C:\\Temp\\Temp.txt", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);

    ReadFile(hFile, &buffer,ReadBytes ,&dwRead ,NULL);
    I can't say for sure.....but that doesn't look work related.

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    Use sizeof() for the readbytes and dwRead as a check that all the data was read.
    Also catch the return of ReadFile(), has to be greater than 0 or error.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  3. 2 questions surrounding an I/O file
    By Guti14 in forum C Programming
    Replies: 2
    Last Post: 08-30-2004, 11:21 PM
  4. File I/O problems!!! Help!!!
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 05-17-2002, 08:09 PM
  5. advice on file i/o
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-29-2001, 04:56 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21