Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdint.h>
- #include <stdlib.h>
- typedef uint_least8_t UTF8;
- int main(int argc, const char * argv[]) {
- // insert code here..
- UTF8 *PathWithoutBOM = u8"/PATH/TO/A/TEXT/FILE.TXT";
- UTF8 *PathWithBOM = u8"\xEF\xBB\xBF/PATH/TO/A/TEXT/FILE.TXT";
- printf("PathWithoutBOM: %s, Size: %d\n", PathWithoutBOM, strlen(PathWithoutBOM));
- printf("PathWithBOM: %s, Size: %d\n", PathWithBOM, strlen(PathWithBOM));
- FILE *FileWithoutBOM = fopen(PathWithoutBOM, "r");
- FILE *FileWithBOM = fopen(PathWithBOM, "r");
- uint8_t *FileWithoutBOMBuffer = calloc(1024, sizeof(UTF8));
- uint8_t *FileWithBOMBuffer = calloc(1024, sizeof(UTF8));
- fread(FileWithoutBOMBuffer, 1, 1024, FileWithoutBOM);
- fread(FileWithBOMBuffer, 1, 1024, FileWithBOM);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement