CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Location
    beyond the pillars of hercules
    Posts
    295

    [RESOLVED] Adding data to file with CreateFile()

    i want to add some data to a txt file and i use CreateFile() and OPEN_EXISTING to do so

    but it will add the data at the beginning of the file , i want to add the data do the end of the file
    how can i do that with CreateFile()? or i cant ? any alternative ways to add data at the end of file?

    heres my code

    Code:
    hFile = CreateFile(_T("C:\\test.txt"),GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    WriteFile(hFile, lpFile_Data, dwFileSize , &dwBytesWritten, NULL);

  2. #2
    Join Date
    Feb 2007
    Location
    Craiova, Romania
    Posts
    326

    Re: Adding data to file with CreateFile()

    See the example from this article, in the community content section.
    http://msdn.microsoft.com/en-us/libr...47(VS.85).aspx

    Regards

  3. #3
    Join Date
    May 2006
    Location
    beyond the pillars of hercules
    Posts
    295

    Re: Adding data to file with CreateFile()

    thank you , exactly what i needed!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured