| | |
Set position in Stream
Please support our C++ advertiser: Intel Parallel Studio Home
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;
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





