Thread

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 . . . // Sdk

1  |  

faber

Nov 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-&gt;Open()&nbsp; ? 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>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Walter aka Faber</DIV>
<DIV>&nbsp;</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 &lt;<A=20
href=3D"mailto:gizmo98 at earthlink.net">gizmo98 at earthlink.net</A>&gt; =
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>&nbsp;</DIV>
<DIV><FONT face=3DArial>CString PathName =3D =
dlgFile.GetPathName();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>char pbuf[999999];<BR>int&nbsp;i =3D =
0;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>while (i &lt; 2)<BR>{</FONT></DIV>
<DIV><FONT face=3DArial>&nbsp;&nbsp;&nbsp; CFile *Parse =3D new =
CFile;</FONT><FONT=20
face=3DArial></FONT></DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;&nbsp;&nbsp; &nbsp;Parse-&gt;Open( =
PathName,=20
CFile::modeRead );<BR>&nbsp;&nbsp;&nbsp; =
&nbsp;Parse-&gt;Read((char*)pbuf,=20
Parse-&gt;GetLength());<BR>&nbsp;&nbsp;&nbsp;=20
&nbsp;Parse-&gt;Close();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;&nbsp;&nbsp; &nbsp;delete=20
Parse;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; &nbsp;i+=3D1;<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>MessageBox((char*)pbuf,"Why did this=20
append???",MB_OK);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;&nbsp;&nbsp; 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&nbsp;/=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>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;&nbsp;&nbsp; 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>&nbsp;</DIV>
<DIV><FONT face=3DArial>Thanks for the help,</FONT></DIV>
<DIV><FONT face=3DArial>Andon M. Coleman</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>Senior Programmer</FONT></DIV>
<DIV><FONT face=3DArial>R&amp;D</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>Nothing, =
Inc.</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0173_01BF2D40.2A8B6AC0--

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn