Win32 API function to replace a byte in file

This is a discussion on Win32 API function to replace a byte in file within the Windows Programming forums, part of the Platform Specific Boards category; Is there a way I can replace a byte in file without reading the whole file and then emptying it ...

  1. #1
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318

    Win32 API function to replace a byte in file

    Is there a way I can replace a byte in file without reading the whole file and then emptying it and writing the whole thing again? WriteFile() only adds to a file.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  2. #2
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Why not use the std-C functions? fopen("somefile", "r+"); Then fseek() back one char.

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    I could try, yes
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    If you really want a non-portable Win32 function then use SetFilePointer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 09:39 AM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-30-2005, 12:21 AM
  4. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 04:39 AM
  5. FILES in WinAPI
    By Garfield in forum Windows Programming
    Replies: 46
    Last Post: 10-02-2003, 07:51 PM

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