How to read drivetable.txt

This is a discussion on How to read drivetable.txt within the C++ Programming forums, part of the General Programming Boards category; Hii I wanna read the file( drivetable.txt ) and write into another file.It is content of System Volume Information folder. ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Location
    Bangalore,India
    Posts
    24

    How to read drivetable.txt

    Hii

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



    Code:
    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 ...to read that file ?




    ----------------------
    Thanking you
    ----------------------

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    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, 02: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

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