CHttpFile::Read not returning all of file? 
Author Message
 CHttpFile::Read not returning all of file?

Is there something that would cause Read to not return the whole file?  Ex:

   CString str;
   DWORD len = 33000;
   char* buf = new char[len];
   len = http_file->Read(buf, len);
   str = buf;
   delete buf;
   str = str.Left(len);

str does not contain the entire file.  However, if I read it in line by
line, (ReadString()) it works correctly.  I would rather use just Read as I
think it works a little faster than reading the file line by line (the
server I am reading from is slow to begin with...).
--
Adam Clauss



Sun, 26 Dec 2004 22:38:32 GMT  
 CHttpFile::Read not returning all of file?
After the str = buf; statement, what are the values of the following:

str.GetLength()
len


Quote:
> Is there something that would cause Read to not return the whole file?
Ex:

>    CString str;
>    DWORD len = 33000;
>    char* buf = new char[len];
>    len = http_file->Read(buf, len);
>    str = buf;
>    delete buf;
>    str = str.Left(len);

> str does not contain the entire file.  However, if I read it in line by
> line, (ReadString()) it works correctly.  I would rather use just Read as
I
> think it works a little faster than reading the file line by line (the
> server I am reading from is slow to begin with...).
> --
> Adam Clauss




Mon, 27 Dec 2004 13:25:46 GMT  
 CHttpFile::Read not returning all of file?
In one I just ran, they were both 4029 (the filesize each time may vary
slightly).

It should actually be more in the range of 30,000 (hence my large buffer).

--
Adam Clauss



Quote:
> After the str = buf; statement, what are the values of the following:

> str.GetLength()
> len



> > Is there something that would cause Read to not return the whole file?
> Ex:

> >    CString str;
> >    DWORD len = 33000;
> >    char* buf = new char[len];
> >    len = http_file->Read(buf, len);
> >    str = buf;
> >    delete buf;
> >    str = str.Left(len);

> > str does not contain the entire file.  However, if I read it in line by
> > line, (ReadString()) it works correctly.  I would rather use just Read
as
> I
> > think it works a little faster than reading the file line by line (the
> > server I am reading from is slow to begin with...).
> > --
> > Adam Clauss




Mon, 27 Dec 2004 21:25:08 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CHttpFile::Read return value

2. CFileDialog in XP not return the file name in shorcut file(.lnk)

3. Why does not read and open return?

4. CHttpFile::SendRequest() doesn't return the control!

5. Reading from a zip file but not actually unzipping the file

6. CInternetFile/CHttpFile has no valid FILE* or file handle

7. CHttpFile/CInternetFile has no valid FILE* or file handle

8. Seek on CHttpFile behaves like a sequential read

9. Problem of CHttpFile::Read(), please help!

10. CHttpFile::QueryInfo() and HTTP_QUERY_SET_COOKIE (read this one)

11. CHttpFile::Read strips Content-Type

12. CHttpFile can't read whole html document.

 

 
Powered by phpBB® Forum Software