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

Threaded View

  1. #1
    Join Date
    Sep 2003
    Location
    England
    Posts
    129

    fgets returns invalid parameter error

    Hello all,

    I am reading from one file, formatting the data and writing it to a different file in the following way:

    Code:
    char input[256];
    FILE *fraw;  -- initialised earlier.
    
    
    while (NULL != fgets(input,sizeof(input),fraw)
    {
      if (5 == sscanf(input, "** formatting selection ** ))
        // process data
      else
        // report error
    }
    This works for a while but often after 62 lines fgets only reads part of the data and reports and invalid parameter error. Sometimes it happens in lines other than the 62nd. The line in question is fine and is in the middle of a load of output generated by the program (all in exactly the same way).

    Can anyone spot what I have done wrong here?
    Last edited by SteveTaylor; April 4th, 2011 at 09:47 AM.

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