Could someone please explain the difference between fopen and CreateFile to me.
I hadn't seen createfile until recently when browsing these forums. What are there pros and cons of each that I should be aware of?
Here is what I found a MS's site:
It seems to me that this accomplishes basically the same thing as fopen would but obviously allows for other options like: sharing and security as per the remarks.Code:HANDLE hFile; hFile = CreateFile("MYFILE.TXT", // create MYFILE.TXT GENERIC_WRITE, // open for writing 0, // do not share NULL, // no security CREATE_ALWAYS, // overwrite existing FILE_ATTRIBUTE_NORMAL | // normal file FILE_FLAG_OVERLAPPED, // asynchronous I/O NULL); // no attr. template
Am I on the right track?
Also, when programming for windows should I generally use createfile or just save this for when I need to use these additional features?