Thread: How to read drivetable.txt

  1. #1
    Registered User
    Join Date
    Jun 2009

    How to read drivetable.txt


    I wanna read the file(drivetable.txt) and write into another file.It is content of System Volume Information folder.

    HANDLE hFile = CreateFile(
    			L"C:\\System Volume Information\\_restore{D66B84B7-13C4-40ED-9116-31C56638FDB0}\\drivetable.txt",
    					 GENERIC_READ,          // open for writing
    					 0,                              // do not share
    					 NULL,                        // default security
    					 OPEN_EXISTING,      // overwrite existing
    					 FILE_ATTRIBUTE_SYSTEM , //  file type 					 
    					 NULL);                  // no attr. template
    	if (hFile == INVALID_HANDLE_VALUE) 
    		printf("Could not open file (error %d)\n", GetLastError());
    		goto lLabel;

    But the given code is not working....

    How I've to set the permissions read that file ?

    Thanking you

  2. #2
    Registered User
    Join Date
    Oct 2006
    first, you say you want to read a file, but in your comments you say "// open for writing". also, you say "// overwrite existing" where these comments don't correspond to your code. if your comments are incorrect, it could be possible your actual code is also incorrect.

    next, what does "But the given code is not working...." mean? is your code compiling? is it getting to the 'createFile' line in your code? upon running that code, what happens? runtime error? does it get into the "hFile == INVALID_HANDLE_VALUE" block? if it gets into this block, what is the error code/message? did you look this error code up on msdn? could tell us what error code and description you are receiving ? etc, etc

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Read() problems
    By yay4rei in forum C Programming
    Replies: 2
    Last Post: 07-21-2005, 10:47 AM
  2. How can I know the actual bytes read in a file read
    By pliang in forum C++ Programming
    Replies: 1
    Last Post: 06-08-2005, 04:23 PM
  3. What Would You Use To Read User Input?
    By djwicks in forum C Programming
    Replies: 11
    Last Post: 04-05-2005, 03:32 PM
  4. Read Array pro!!Plz help!!
    By Supra in forum C Programming
    Replies: 2
    Last Post: 03-04-2002, 03:49 PM
  5. Help! Can't read decimal number
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 09-07-2001, 02:09 AM