Saturday, May 22, 2010

Can anybody walk me through the process to read/write files using the Windows API / C?

I am using the Little C Compiler (LCC) installation (I have previous experience writing AWK scripts). I can't use the internet very much during working hours, so constant reference to MSDN is not an option.

Can anybody walk me through the process to read/write files using the Windows API / C?
I have always used fopen(), fread(), fwrite(), fclose().





I am doing this from memory so it may not compile.





unsigned char RWString[500];


unsigned int Number;





File* FilePtr = fopen("FileName.xxx", w);


//the w = write but could be r = read, b= binary


Number = 10; //number of bytes you want to read


fread(FilePtr, RWString, Number);


fwrite(FilePtr, RWString, Number);


fclose(FilePtr);


No comments:

Post a Comment