I am creating the file using Createfile function. The C program is working fine but I am unable to see the created file in the respective folder. Also "view hidden files" option is checked.
You can check if the function worked correctly by checking out the returned HANDLE value.
edit: A C program continues to function (incorrectly though) if a functions fails. It's therefore very important to check each and every returned HANDLE.
edit: The returned HANDLE should not be INVALID_HANDLE_VALUE. (But I can imagine that NULL isn't good either).
Two things to check for. Number one, did it actually succeed? From the docs:
Return Value
If the function succeeds, the return value is an open handle to the specified file, device, named pipe, or mail slot.
If the function fails, the return value isINVALID_HANDLE_VALUE
. To get extended error information, callGetLastError
.
Number two, are you looking in the right place. Frequently, people who run their code from within an IDE don't realise that their current working directory is not always what they think it is. You can system("cd");
or something similar to see what it actually is.
Or, you can use absolute pathnames to ensure the file is being created at the right place (for testing, that is - you should never use absolute paths for production code).
If neither of those two suggestions help, you should post the code that shows the particular problem. Preferably enough so that we don't have to come back and ask for more.