Right-click on your project in the Solution Explorer and click Properties.
Select Configuration Properties -> General.
Set the Character Set to Use Multi-Byte Character Set.
///////////////////////////////////////////////////////////////////////////////// Set the filename (could also get from a command-line parameter) fileName = "c:\\samples\\binary.jpg";// Open the specified file in binary mode ("rb") file = fopen(fileName, "rb");// If the file wasn't opened successfully, print an error and close if(file == NULL)// Determine the file size fseek(file, 0L, SEEK_END);// Allocate the read buffer readBuffer = (char *)malloc(fileSize);// Read the file's data into the read buffer long read = fread(readBuffer, 1, fileSize, file);// Do something with the data // ... // Free allocated memory and close the file free(readBuffer); |
No comments:
Post a Comment