Click here to Skip to main content
16,011,950 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralFunny C++ Pin
Almindra20-Feb-04 0:27
Almindra20-Feb-04 0:27 
GeneralRe: Funny C++ Pin
David Crow20-Feb-04 3:12
David Crow20-Feb-04 3:12 
GeneralRe: Funny C++ Pin
Almindra20-Feb-04 4:21
Almindra20-Feb-04 4:21 
GeneralRe: Funny C++ Pin
David Crow20-Feb-04 4:40
David Crow20-Feb-04 4:40 
GeneralRe: Funny C++ Pin
Tim Smith20-Feb-04 4:31
Tim Smith20-Feb-04 4:31 
GeneralRe: Funny C++ Pin
jbarton20-Feb-04 3:22
jbarton20-Feb-04 3:22 
Questionhow to open file Pin
Goh Hui Beng20-Feb-04 0:24
Goh Hui Beng20-Feb-04 0:24 
AnswerRe: how to open file Pin
rw10420-Feb-04 1:56
rw10420-Feb-04 1:56 
Wink | ;)
Goh,
Hope this helps...

FILE* bmp = fopen (szFileName,"rb"); // creates a FILE pointer szFileName
is char[] containing the file name that is passed to the operation.

if (!bmp) return false;//if null e.g no file found

BITMAPFILEHEADER BMPFileHeader;//create handles for the file
BITMAPINFOHEADER BMPHeader;

//fread does the actual loading
fread (&BMPFileHeader,sizeof(BITMAPFILEHEADER),1,bmp);
fread (&BMPHeader,sizeof(BITMAPINFOHEADER),1,bmp);

//check for valid headers date etc..
if (BMPFileHeader.bfType != 0x4d42) {fclose (bmp); return false;}
if (BMPHeader.biSize != sizeof(BITMAPINFOHEADER)) {fclose (bmp); return false;}
if (BMPHeader.biPlanes != 1) {fclose (bmp); return false;}
if (BMPHeader.biCompression != BI_RGB) {fclose (bmp); return false;}

unsigned long BitColor = BMPHeader.biBitCount;

so if success bmp contains a pointer to the bitmap file.

Does this help???? or do you need more info, not sure of your experience etc..
Big Grin | :-D

Ross W

GeneralRe: how to open file Pin
Goh Hui Beng20-Feb-04 5:20
Goh Hui Beng20-Feb-04 5:20 
GeneralRe: how to open file Pin
rw10420-Feb-04 5:44
rw10420-Feb-04 5:44 
GeneralRe: how to open file Pin
Goh Hui Beng21-Feb-04 16:22
Goh Hui Beng21-Feb-04 16:22 
Generalvector<CString> *pvecString ?? :confused: Pin
Nirav Doshi19-Feb-04 23:30
Nirav Doshi19-Feb-04 23:30 
GeneralRe: vector<CString> *pvecString ?? :confused: Pin
Andrew Walker19-Feb-04 23:34
Andrew Walker19-Feb-04 23:34 
GeneralRe: vector<CString> *pvecString ?? :confused: Pin
Nirav Doshi19-Feb-04 23:43
Nirav Doshi19-Feb-04 23:43 
GeneralRe: vector<CString> *pvecString ?? :confused: Pin
Henrik Stuart20-Feb-04 0:03
Henrik Stuart20-Feb-04 0:03 
GeneralRe: vector<CString> *pvecString ?? :confused: Pin
Nirav Doshi20-Feb-04 1:52
Nirav Doshi20-Feb-04 1:52 
GeneralRe: vector<CString> *pvecString ?? :confused: Pin
John M. Drescher20-Feb-04 2:44
John M. Drescher20-Feb-04 2:44 
GeneralRe: vector<CString> *pvecString ?? :confused: Pin
Nirav Doshi20-Feb-04 3:51
Nirav Doshi20-Feb-04 3:51 
GeneralRe: vector<CString> *pvecString ?? :confused: Pin
Tim Smith20-Feb-04 4:37
Tim Smith20-Feb-04 4:37 
GeneralRe: vector<CString> *pvecString ?? :confused: Pin
Robert A. T. Káldy20-Feb-04 6:52
Robert A. T. Káldy20-Feb-04 6:52 
GeneralRe: vector<CString> *pvecString ?? :confused: Pin
Nirav Doshi20-Feb-04 7:24
Nirav Doshi20-Feb-04 7:24 
GeneralRe: vector<CString> *pvecString ?? :confused: Pin
John M. Drescher24-Feb-04 16:15
John M. Drescher24-Feb-04 16:15 
GeneralProblem with jpg Pin
Jay.Jay19-Feb-04 22:47
Jay.Jay19-Feb-04 22:47 
Generalassembly and c++ code problem please help Pin
dj_felix19-Feb-04 22:12
dj_felix19-Feb-04 22:12 
GeneralRe: assembly and c++ code problem please help Pin
Maxwell Chen19-Feb-04 22:23
Maxwell Chen19-Feb-04 22:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.