Can't get desired data value from array

Joined
Sep 6, 2007
Messages
7
Reaction score
0
part of the code, reading an image file into memory
--------------------------------------------------------
unsigned char Picture[Size][Size][BytesPerPixel];

if (!(file=fopen(argv[1],"rb")))
{
cout << "Cannot open picture: " << argv[1] <<endl;
exit(1);
}
fread(Picture, sizeof(unsigned char), Size*Size*BytesPerPixel, file);
fclose(file);
---------------------------------------------------------
when i tryied to get the value of the 1st element in Picture, i put

cout << Picture[0][0][0] << endl; after fread(.... before flose(file); ,

it turned out to be nothing printed on my WinXP command prompt. However, the image file was stored successfully because i got the desired image after end of execution(store pic and spit out the exact same pic). the problem is i couldn't get the values stored in Picture.


any ideas ? thx. ...racking my brain....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top