Samuel Tesla (stesla) wrote in lj_dev,
Samuel Tesla
stesla
lj_dev

I C a bug, but I can't C how to fix it...

In my client code, I'm using fgets() to read in my console input...but, if I enter more on the stream than fgets() reads in, it gets read into the next stream...which may or may not be bad (in this case it is).

I've tried doing things like using fseek(), but that doesn't work for stdin. I'm tempted to try and slurp away the extra bytes with an extra fgets(), but I'm sure there's a Better Way To Do It (TM).

Any suggestions?
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 4 comments