I'm getting this acess error trying to read in from a file.
1 2 3
First-chance exception at 0x77cf8dc9 in Testing_OpenGL.exe: 0xC0000005: Access violation writing location 0x00000014.
Unhandled exception at 0x77cf8dc9 in Testing_OpenGL.exe: 0xC0000005: Access violation writing location 0x00000014.
The program ' Testing_OpenGL.exe: Native' has exited with code -1073741819 (0xc0000005).
Here is the code. It breaks on line 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
//Open the file
fprintf(stderr, "Object not opened!");
//Read the file
1) You're not checking if the getline fails, thereby attempting to push a garbage string.
2) If the getline fails, you have no guarantee that buf is terminated with a null, therefore the new string can continue searching past buf for a null terminator resulting in an access violation.