0 Members and 3 Guests are viewing this topic.
unsigned short* imageLoadFromFile(char *path){ FILE* readFile = fopen(path, "rb" ); if(readFile == NULL){ return NULL; } fseek(readFile, 0L, SEEK_END); int size = ftell(readFile); fseek(readFile, 0L, SEEK_SET); unsigned short *array; array = (unsigned short *) malloc(size); if(array == NULL) { return NULL; } int i; for(i = 0; i < size/2; i++){ array[i] = fgetc(readFile) << 8; array[i] += fgetc(readFile); } fclose(readFile); return array;}