in reply to Wht is my .txt file full of garbage? And why does this flock cause a compilation error?

I'd guess that rob_au is correct about importing the constants. Read flock to see how to import the constants.

As for the garbage in the file.. there's one thing that I see that could be causing it. When you read in the data, where's the file pointer? You then truncate the file. I'm not positive, but I think your pointer is beyond the end of the file.

Before you truncate it, do a

seek FH, 0, 0;
I did a quick test and without the seek, I couldn't see anything in the file. When I used seek, everything printed fine.

Hope this helps..
Rich

  • Comment on Re: Wht is my .txt file full of garbage? And why does this flock cause a compilation error?
  • Download Code

Replies are listed 'Best First'.
Re: Re: Wht is my .txt file full of garbage? And why does this flock cause a compilation error?
by jerrygarciuh (Curate) on Nov 14, 2001 at 07:25 UTC
    Thanks!! The seek did the trick!
    TIA
    jg
    _____________________________________________________
    My name is Inigo Montoya...