wxInputStream and SeekI function
wxInputStream and SeekI function
I need in my application to change the stream position in the wxInputStream object and I used the SeekI() function and it does not work at all. I read in the documentation that the seek functions doesn't work on all streams. Do you have any ideas how to solve this problem. Thanks.
- Ryan Norton
- wxWorld Domination!
- Posts: 1319
- Joined: Mon Aug 30, 2004 6:01 pm
Re: wxInputStream and SeekI function
What kind of stream? Could you post some code?rem wrote:I need in my application to change the stream position in the wxInputStream object and I used the SeekI() function and it does not work at all. I read in the documentation that the seek functions doesn't work on all streams. Do you have any ideas how to solve this problem. Thanks.
Anyway, if the stream really doesn't support seek, just read data into a temporary buffer until you get to the position you desire.
[Mostly retired moderator, still check in to clean up some stuff]
The piece of code looks like this
wxURL url("http://a.host/a.dir/a.file");
wxInputStream* i_stream = url.GetInputStream();
i_stream->SeekI(newposition, wxFromStart);
Anyway, if the stream really doesn't support seek, just read data into a temporary buffer until you get to the position you desire.
I could do that but what if the file has 10MB?
I had to wait for 5 minutes to read the data i'm interested in.
wxURL url("http://a.host/a.dir/a.file");
wxInputStream* i_stream = url.GetInputStream();
i_stream->SeekI(newposition, wxFromStart);
Anyway, if the stream really doesn't support seek, just read data into a temporary buffer until you get to the position you desire.
I could do that but what if the file has 10MB?
I had to wait for 5 minutes to read the data i'm interested in.
AFAIK seeking and querying the input stream size aren't supported for i-net streams (http and ftp).
I think the problem with seeking is that it works in a different way. When using SeekI, the file has to be open already. But when you query data using http or ftp, you have to specify the read position together with your read request (or before when using ftp).
Regards,
Mark
I think the problem with seeking is that it works in a different way. When using SeekI, the file has to be open already. But when you query data using http or ftp, you have to specify the read position together with your read request (or before when using ftp).
Regards,
Mark