it depends on the lib
Typically individual pixels are in (A)RGB groups (32-bit XRGB or ARGB, or RGBX/RGBA -- or sometimes even 24-bit RGB). So to make a pixel black you'd just set its R,G, and B components to 0. How these are stored can vary depending on the lib. Some encase them in a struct:
1 2 3 4
|
struct PIXEL
{
unsigned char a,r,g,b;
};
|
Some just use an array, or some use unsigned longs for the whole shebang.
Though if you're asking this kind of question you're starting at the wrong point... you're trying to swallow too much at once. Before worrying about grabbing images from a camera and displaying them (or whatever it is you're trying to do), start with one smaller aspect of what you need to do.
For example if you're intending to draw these images to the user, get a library that does that, and learn how to use it. It may have built-in jpeg support, even, making your life easier. If not, you can look for another library which reads jpegs and learn how to use that. Then "translate" between the output of the jpeg lib and the input of the drawing (if you understand how both work, that shouldn't be hard)
It's really hard to get into specifics as to what code you need without saying what library you're using. You really need to just look into some libraries and pick one (or more) which does what you need. The answer to all your questions lie in the library API -- and without a library you're not going to have any answers.
What
specifically are you trying to do? I know it involves webcams somehow, but other than that I'm not really sure. Maybe it might be easier to recommend a library to suit your needs if I knew more about what you're doing -- although I have never done any work with webcams before so I don't know of ways to interface with them. Perhaps try googling "webcam C++ library" or something.
-------------------------------
As for reading binary files
If you're using ifstream, open the stream with ios::binary, and call mystream.read(). See reference page:
http://cplusplus.com/reference/iostream/istream/read.html
If you're using stdio, open the steram with the 'b' flag ("such as "rb" or "r+b"), and use fread(). See reference page:
http://cplusplus.com/reference/clibrary/cstdio/fread.html