Click here to Skip to main content
15,892,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralReading A File Pin
LighthouseJ12-Apr-05 11:33
LighthouseJ12-Apr-05 11:33 
GeneralFollow-Up Pin
LighthouseJ12-Apr-05 16:03
LighthouseJ12-Apr-05 16:03 
GeneralRe: Follow-Up Pin
John R. Shaw12-Apr-05 19:16
John R. Shaw12-Apr-05 19:16 
GeneralRe: Follow-Up Pin
LighthouseJ12-Apr-05 19:30
LighthouseJ12-Apr-05 19:30 
GeneralRe: Follow-Up Pin
John R. Shaw12-Apr-05 20:43
John R. Shaw12-Apr-05 20:43 
GeneralRe: Follow-Up Pin
LighthouseJ13-Apr-05 4:02
LighthouseJ13-Apr-05 4:02 
GeneralRe: Reading A File Pin
Ryan Binns12-Apr-05 18:25
Ryan Binns12-Apr-05 18:25 
GeneralRe: Reading A File Pin
LighthouseJ12-Apr-05 19:16
LighthouseJ12-Apr-05 19:16 
Well, it's kind of spread out, but I can put the relevant parts back together. I have a class that doles out the data to the function I'm trying to use it in. It's pretty standard file pointer things and I've used file pointers exclusively in the past on countless programs.

Here's some code snips:
CBitmapFile::CBitmapFile(CString fileName) {<br />
bmpFP = fopen((LPCTSTR)fileName, "r");


Where bmpFP is a member variable in CBitmapFile.


Here's the function that I call to get data:
BYTE CBitmapFile::GetNextByte() {<br />
	BYTE data;<br />
	//fscanf(bmpFP, "%c", &data);<br />
	data = getc(bmpFP);<br />
	nBytesRead++;<br />
	nVerticalPosition++;<br />
	nCurrentPosition = ftell(bmpFP);<br />
	//CheckAlignment();<br />
	return data;<br />
}


I used fscanf, I'm trying to use file streams now but even after I include ifstream, fstream or anything else to try, the compiler still doesn't know what ifstream is even though I can hover the cursor over it and then start to use it and VS brings up that little class object list as I type.

Here's where I actually use the function. At this time I am only spitting the data back into another file for debug purposes but I'll eventually put the data into a CByteArray and then transmit it.

FILE * outFP = fopen("debug.dat", "w");<br />
for (int i=0; i<PacketSize; i++) {<br />
byte = BitmapFileReader->GetNextByte();<br />
//fputc(byte, outFP);<br />
fprintf(outFP, "%c", byte);<br />
}


PacketSize will almost always be 64. That for loop is inside a larger loop to keep going until it's created every packet. It's real simple, I can change functions to read the data, but I still get the same irregularities.
GeneralRe: Reading A File Pin
namaskaaram12-Apr-05 21:20
namaskaaram12-Apr-05 21:20 
GeneralRe: Reading A File Pin
LighthouseJ13-Apr-05 4:01
LighthouseJ13-Apr-05 4:01 
GeneralRe: Reading A File Pin
Blake Miller13-Apr-05 7:12
Blake Miller13-Apr-05 7:12 
GeneralRe: Reading A File Pin
namaskaaram13-Apr-05 19:36
namaskaaram13-Apr-05 19:36 
Generalserial port comm at low baud rate (50/75 /100 baud) in windows Pin
pcm21112-Apr-05 8:40
pcm21112-Apr-05 8:40 
GeneralCToolBar and CToolBatCtrl Pin
odiesback12-Apr-05 8:40
odiesback12-Apr-05 8:40 
GeneralRe: CToolBar and CToolBatCtrl Pin
Jack Puppy12-Apr-05 12:50
Jack Puppy12-Apr-05 12:50 
GeneralRe: CToolBar and CToolBatCtrl Pin
odiesback13-Apr-05 4:33
odiesback13-Apr-05 4:33 
GeneralAdding a file to Windows MRU Pin
yarp12-Apr-05 8:36
yarp12-Apr-05 8:36 
GeneralRe: Adding a file to Windows MRU Pin
Gary Kirkham12-Apr-05 8:38
Gary Kirkham12-Apr-05 8:38 
GeneralRe: Adding a file to Windows MRU Pin
yarp12-Apr-05 9:00
yarp12-Apr-05 9:00 
GeneralRe: Adding a file to Windows MRU Pin
Bob Stanneveld12-Apr-05 22:41
Bob Stanneveld12-Apr-05 22:41 
GeneralRe: Adding a file to Windows MRU Pin
yarp13-Apr-05 1:51
yarp13-Apr-05 1:51 
Generalinstallshield vc++ 6 regsvr32 myDLL Pin
Anonymous12-Apr-05 6:41
Anonymous12-Apr-05 6:41 
QuestionHow to develope a project to navigate pst file with mapi. Pin
elicor12-Apr-05 5:48
elicor12-Apr-05 5:48 
GeneralSetting Printer Resolution Pin
bk515112-Apr-05 4:44
bk515112-Apr-05 4:44 
GeneralRe: Setting Printer Resolution Pin
liquid_12-Apr-05 7:06
liquid_12-Apr-05 7:06 

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.