CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [C] parsing EOF

  1. #1
    Join Date
    Jun 2012
    Posts
    58

    [C] parsing EOF

    Hi,

    Someone came to me for help with a task. THat someone takes part in a very basic C course, and this is only their 1st day. The task left me clueless, anyways...
    Note that the required language is not c++, but c; however, i hope someone can help me out anyways...
    Here`s the text:

    YOu have to expect the following input:
    an arbitrary amount of lines, each line consists of 5 int32 numbers. The full input will be terminated by an EOF.
    e.g.:

    1 2 3 4 5
    6 7 8 9 0

    ...
    you`re then supposed to convert the numbers to integers and do some calculations.
    i would know how to parse a single line of 5 numbers via scanf(). That`s easy, and that`s exactly what they did in class.


    But how do i go about splitting the lines? What about the EOF?
    Even if could hack something together, by using errno or something, it would be way beyond what they are doing atm.

    the input is received via user input, ie stdin.

    is there any easy way i missed?
    Last edited by tuli; October 26th, 2012 at 09:42 AM.

  2. #2
    Join Date
    Jan 2009
    Posts
    1,689

    Re: [C] parsing EOF


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured