I’ve written the following function to resize a given binary file to a given size.
The function works when the file is located at C:\ , but it does not when the file is inside a folder.
Any idea why this is happening?
void truncate_file (long int new_size , char* file_name)
char szFileName[MAX_PATH]; //full path
HANDLE hFile = CreateFile(szFileName,GENERIC_WRITE,
0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);