Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

How to change the file indicator position in cpp?

42ndEngineer

Newbie level 2
Joined
May 24, 2020
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
12
I tried using seekg but it didnt work. Im trying to read a specific line(like 3rd line) by getline function. When i use seekg i cant even read from the start(i tried seekg(0)). It would be great if anyone can help.
 

std_match

Advanced Member level 4
Joined
Jul 9, 2010
Messages
1,083
Helped
409
Reputation
818
Reaction score
404
Trophy points
1,363
Location
Sweden
Activity points
8,276
I haven't used seekg, but how would you use it to read a specific line?
It seems that seekg doesn't know anything about lines.

I think you should use getline repeatedly until you reach the wanted line, and just ignore the lines before it.
 

42ndEngineer

Newbie level 2
Joined
May 24, 2020
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
12
I did what you said but i was looking or an efficient way because if i move indicator where i want it would improve my code so much.
 

Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top