Hey,
I am trying to do a small part of the assignmet given to me, but cannot manage to get it to work.
I want to open a jpeg file which already exists.. and then convert it into streams of 100 bytes of code (frame). Upon running the following program, nothing happens?! :S I have no idea what is happening..
A window pops up saying:
"An unhandled exception of type 'System.NullReferenceException' occured in 'TryOut.exe.
Additional Information: Object reference not sent to an instance of an object."
The following is the code:
Code:
#include <stdio.h>
int main (void)
{
unsigned char frame[100], plz;
int i;
FILE *cfPtr;
if((cfPtr = fopen("C:/Documents and Settings/photo1.jpg", "rb") == NULL))
{
printf("File could not be opened\n");
scanf("%d\n\n", &plz);
}
else
{
while (!feof(cfPtr))
{
for(i = 1; i <= 100; i++)
{
fread(&frame[i], sizeof(char),1,cfPtr);
printf("%d\n", frame[i]);
scanf("%d\n\n", &plz);
}
}
fclose(cfPtr);
}
return 0;
}