Thread: fscaf

  1. #1
    Registered User
    Join Date
    Dec 2001


    can someone please tell me how to read in a record that has variable length fields. The fields are delimited by commas.

    The fields to be read are:
    Student Number (5 digits)
    Student Name (25 characters max.)
    Curriculum Code (3 characters)
    8 Class Work Grades (2 characters max., may be : a+, a, a-, b+, b, b-, c+... f)
    4 Test Grades (3 digits max.)
    Final Exam (3 characters max., [not a mistake!!])

    Sample Record:
    43695,robert hilling,dpi,a+,c-,c,b+,b,d,a,f,100,88,93,82,93

    Any Help would be greatly appreciated.

  2. #2
    Registered User
    Join Date
    Dec 2001
    read in the whole line with fgets() and get the parts by using strtok (string.h)
    Hope you don't mind my bad english, I'm Austrian!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with fscaf() to getc() and fprintf() to putc()
    By otchster in forum C Programming
    Replies: 14
    Last Post: 10-30-2005, 11:58 PM