Welcome to Dream.In.Code
Click Here
Getting C++ Help is Easy!

Join 118,862 C++ Programmers for FREE! Ask your question and get quick answers from experts. There are 1,725 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Skip a line using fscanf in C Standard.

 
Reply to this topicStart new topic

Skip a line using fscanf in C Standard.

nombre
post 20 Jul, 2008 - 02:18 AM
Post #1


New D.I.C Head

*
Joined: 7 Jun, 2008
Posts: 49

How do I skip a line in a file while reading from it in C Standard preferably using fscanf and a seperate statement?
User is offlineProfile CardPM

Go to the top of the page


no2pencil
post 20 Jul, 2008 - 02:24 AM
Post #2


Wet D.I.C.

Group Icon
Joined: 10 May, 2007
Posts: 5,523



Thanked 36 times

Dream Kudos: 2350

Expert In: Goofing Off

My Contributions


Without seeing code & knowing the exact situation you want to skip, my suggestion would be create a flag, named appropriately, & when you've hit the condition where you want to skip, change the value of the flag so fscanf stops sending the outpt but continues to read. Once your condition is hit (probably the end of the line, since you're asking about skipping a line) turn the flag back off, & continue to send fscanf output to the desired location.
User is online!Profile CardPM

Go to the top of the page

nombre
post 20 Jul, 2008 - 02:38 AM
Post #3


New D.I.C Head

*
Joined: 7 Jun, 2008
Posts: 49

This is the situation that I'm trying to read in. The PROGRAM string and the SEGMENT string are just placeholders. After the SEGMENTS lengths are described I need to skip a line. After the SEGMENTS themselves are listed I need to skip two. The complication is that the skipping needs to occur in different functions.

By the way, thanks for your quick reply no2pencil.


CODE
PROGRAM  2
SEGMENT  4    0x0B
SEGMENT  7    0xA0

SIO    75
DISK   150
SKIP   0
JUMP   [1,0]

SIO    40
DSK2   10
WIO    50
REQ    [0,1]
WIO    0
REQ    [1,1]
END    20


PROGRAM  1
SEGMENT  9    0xFF

SIO    10
DISK   45
WIO    0
REQ    [0,1]
SIO    250
RDSK   40
WIO    5000
REQ    [0,5]
END    10


User is offlineProfile CardPM

Go to the top of the page

nombre
post 20 Jul, 2008 - 03:24 AM
Post #4


New D.I.C Head

*
Joined: 7 Jun, 2008
Posts: 49

I think I got it no2pencil, but if you have any code ideas let me know.
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 10/13/08 01:55AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month