ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Re: CFile oddities . . . I need some help with this if I'm to finish my DJ BOT . . . (Sdk)
Re: CFile oddities . . . I need some help with this if I'm to finish my DJ BOT . . . // SdkfaberNov 12, 1999, 11:03am
This is a multi-part message in MIME format.
------=_NextPart_000_0173_01BF2D40.2A8B6AC0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Did you check the return code of Parse->Open() ? if it cannot open, it = cannot read, and if it cannot read, it does not change the contents of = your 1MB file buffer (!) Walter aka Faber Andon M. Coleman <gizmo98 at earthlink.net> schrieb in im Newsbeitrag: = 37f62b03.0 at homer... Anyway . . . My problem is stated in the following lines of code . . . =20 CString PathName =3D dlgFile.GetPathName(); char pbuf[999999]; int i =3D 0; while (i < 2) { CFile *Parse =3D new CFile; =20 Parse->Open( PathName, CFile::modeRead ); Parse->Read((char*)pbuf, Parse->GetLength()); Parse->Close(); delete Parse; =20 i+=3D1; } MessageBox((char*)pbuf,"Why did this append???",MB_OK); Why does this append? Even when I make pbuf local to the While = Block, it still appends . . . This is not my actual problem, however, this replicates the problem = I'm having . . .=20 I cannot perform an OPEN action and SAVE / IMPORT / EXPORT action in = the same session of=20 DJ BOT, because even though I'm creating new CFile objects I still end = up with data from the last Read(); in my buffer . . . This is also the problem which is keeping me from finishing my = Install from the WEB Package, and my Auto-Update project. Thanks for the help, Andon M. Coleman Senior Programmer R&D Nothing, Inc. ------=_NextPart_000_0173_01BF2D40.2A8B6AC0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV>Did you check the return code of Parse->Open() ? if it = cannot=20 open, it cannot read, and if it cannot read, it does not change the = contents of=20 your 1MB file buffer (!)</DIV> <DIV> </DIV> <DIV> </DIV> <DIV>Walter aka Faber</DIV> <DIV> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: = 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"> <DIV>Andon M. Coleman <<A=20 href=3D"mailto:gizmo98 at earthlink.net">gizmo98 at earthlink.net</A>> = schrieb in=20 im Newsbeitrag: 37f62b03.0 at homer...</DIV> <DIV><FONT face=3DArial>Anyway . . . My problem is stated in the = following lines=20 of code . . .</FONT></DIV> <DIV><FONT face=3DArial></FONT> </DIV> <DIV><FONT face=3DArial>CString PathName =3D = dlgFile.GetPathName();</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial>char pbuf[999999];<BR>int i =3D = 0;</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial>while (i < 2)<BR>{</FONT></DIV> <DIV><FONT face=3DArial> CFile *Parse =3D new = CFile;</FONT><FONT=20 face=3DArial></FONT></DIV> <DIV><FONT face=3DArial></FONT> </DIV> <DIV><FONT face=3DArial> Parse->Open( = PathName,=20 CFile::modeRead );<BR> = Parse->Read((char*)pbuf,=20 Parse->GetLength());<BR> =20 Parse->Close();</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> delete=20 Parse;<BR> <BR> i+=3D1;<BR>}</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial>MessageBox((char*)pbuf,"Why did this=20 append???",MB_OK);</FONT></DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV><FONT face=3DArial> Why does this append? Even = when I=20 make pbuf local to the While Block, it still appends . . = ..</FONT></DIV> <DIV><FONT face=3DArial>This is not my actual problem, however, this = replicates=20 the problem I'm having . . . </FONT></DIV> <DIV><FONT face=3DArial>I cannot perform an OPEN action and SAVE / = IMPORT /=20 EXPORT action in the same session of </FONT></DIV> <DIV><FONT face=3DArial>DJ BOT, because even though I'm creating new = CFile=20 objects I still end up with data from the last Read();</FONT></DIV> <DIV><FONT face=3DArial>in my buffer . . .</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> This is also the problem = which is=20 keeping me from finishing my Install from the WEB Package, and = my</FONT></DIV> <DIV><FONT face=3DArial>Auto-Update project.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial>Thanks for the help,</FONT></DIV> <DIV><FONT face=3DArial>Andon M. Coleman</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial>Senior Programmer</FONT></DIV> <DIV><FONT face=3DArial>R&D</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial>Nothing, = Inc.</FONT></DIV></BLOCKQUOTE></BODY></HTML> ------=_NextPart_000_0173_01BF2D40.2A8B6AC0-- |