|
-
June 24th, 2002, 06:53 AM
#1
About monochrome format
I need to read a monochrome image in C++ but there is no a function or something like that. The problem is to read it, available definitions in C++ don´t permit to work in binary format and I need the code source that permits it. Thanks a lot.
-
June 24th, 2002, 01:25 PM
#2
Are you trying to read a .bmp file? If all else fails in C++, you could fall back into C and use FILE*. eg
#include <stdio.h>
FILE* image = fopen ("filename", "r+b"); // b means binary
fread (
buffer, // The input buffer - you have to new this
1, // size of each item
size, // total size
image);
I haven't done binary I/O in C++. I'll dig through my books and see what there is.
Succinct is verbose for terse
-
June 24th, 2002, 02:21 PM
#3
I don't know if this is VC++ specific. To open a binary file using streams, use
ifstream bmp(bmpfilename);
bmp.setmode(filebuf::binary);
The default is filebuf::text.
Succinct is verbose for terse
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|