reading in HH:MM:SS time in C

Can anyone help me with how to read in times from a file in C? Need to use fscanf to read in for example 12:30:22.2. I tried reading it in as a string but would not work. Thanks.


Comments

  • : Can anyone help me with how to read in times from a file in C? Need to use fscanf to read in for example 12:30:22.2. I tried reading it in as a string but would not work. Thanks.
    :
    :
    :

    post the code you tried. why can't you read it as one big string? fgets() might work better for that, assuming the time is on a line all by itself. post your code and a couple lines from the file you are working with.
  • : : Can anyone help me with how to read in times from a file in C? Need to use fscanf to read in for example 12:30:22.2. I tried reading it in as a string but would not work. Thanks.
    : :
    : :
    : :
    :
    : post the code you tried. why can't you read it as one big string? fgets() might work better for that, assuming the time is on a line all by itself. post your code and a couple lines from the file you are working with.
    :


    I just figured out what the problem was. I had an error in my fscanf line - extra variable. I am able to read the time as %s now. Can't use fgets() because the time is in a line with a bunch of other integers and floats. Thanks for your assistance. -Eric.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories