In order to fix the access violation error you will need to modify slapshot_io's code a little.
Include some additional header files:
C Code:
#include <stdlib.h>
#include <malloc.h>
Then change the following line:
to
C Code:
char *input = (char *)malloc(1024); //Allocate a 1024 byte space for our input string
This piece of code I changed is what caused the access violation error, it sets input to NULL, or 0. The scanf() call that follows then tries to read the input string into a buffer located at 0x0000000, but that memory is not allocated and you will get an access violation error. I changed this piece of code to allocate 1024 bytes of memory and then put the location of that piece of into input, instead of 0x0000000.
There's also a second error in the code:
C Code:
if(str[size] == 0x4F || str[size] == 0x6F)
if(str[size + 1] == 0x48 || str[size + 1] == 0x68)
return TRUE;
Here it reads str[size] and str[size + 1] to get the second-to-last and last item, respectively. This is incorrect. It should be str[size - 2] and str[size - 1]. (remember, C arrays start indexing at zero. The highest index in an array of 30 items will be 29.)
I made these changes, and then tested the program. It worked just fine.