| | |
Set position in Stream
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Feb 2008
Posts: 517
Reputation:
Solved Threads: 1
When reading a txt file I am using .seekg to set the startpoint in the file to read from.
linepos has a value: 1002106
First I wonder what this value stands for excatly. As I have understand this is how many characters forward in the file that will be the absolute position from where the reading will start.
Now I am using StreamReader wich also has the ->Seek wich needs 2 arguments.
However when I am trying to put a startposition like this it will not compile.
What I wonder is how I can use the Pos Value to put this to ->Seek( , );
linepos has a value: 1002106
First I wonder what this value stands for excatly. As I have understand this is how many characters forward in the file that will be the absolute position from where the reading will start.
Now I am using StreamReader wich also has the ->Seek wich needs 2 arguments.
However when I am trying to put a startposition like this it will not compile.
What I wonder is how I can use the Pos Value to put this to ->Seek( , );
//File1.seekg Seek to right point in file to start reading from File1.seekg( linepos ); int Pos = linepos; //Pos gives a value of 1002106 StreamReader^ sr = gcnew StreamReader(FileToRead); sr->BaseStream->Seek(0, Pos15); // ::SeekOrigin might need to be used in any way sr->BaseStream->Seek(0, System::IO::SeekOrigin::Begin = Pos15);
Last edited by Jennifer84; Oct 6th, 2008 at 4:09 pm.
•
•
Join Date: Feb 2008
Posts: 517
Reputation:
Solved Threads: 1
Found the solution here.
C++ Syntax (Toggle Plain Text)
sr->BaseStream->Seek(Pos, System::IO::SeekOrigin::Begin);
![]() |
Similar Threads
- Jumble solver (Python)
- Binary File IO (C#)
- memcmp help needed (C++)
- DVD+RW/+R Burning problems Update (Storage)
- reading input ... quick C++ question ... (C++)
- reading a file into code (Java)
- Java JDBC ResultSet (Java)
- VC++:convert File IStream to hex and store...? (C++)
- Need help with DirectX code (C)
Other Threads in the C++ Forum
- Previous Thread: *this problem (help?)
- Next Thread: Help With FUNCTion;
Views: 1008 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api array arrays based beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete deploy dll download dynamic encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib library lines linker list loop looping loops map math matrix memory microsoft newbie news number output pointer problem program programming project python random read recursion recursive reference return simple sort spoonfeeding stream string strings struct temperature template templates test text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets





