Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

getchar() in C language URGENT

Status
Not open for further replies.

raul260291

Junior Member level 1
Joined
Jul 1, 2011
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,389
Normally while reading a text file we use a loop command
while((c=getchar()) != EOF)
and when it reaches the EOF the loop breaks.

Question : Is there any way that we can jump the control again to the beginning of the text file so that c=getchar() begins again???
 

Hi, I think you are going to have to clear/close the file you just read and reopen it again since it is already at eof.
 

Hello!

Hi, I think you are going to have to clear/close the file you just read and reopen it again since it is already at eof.

No, you don't have to close the file. You can use ftell, fseek.

- ftell tells you the position of the reading point
- fseek sets the position.

If you do : seek(f0, 0, 0), then you're back to the beginning of the file.

Dora.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top