On Mon, Feb 04, 2002 at 12:35:46PM -0800, Jamie Harrell wrote:
> sprintf(buf, "ls %s/%s.* > accountownz", PLAYER_DIR, lookup_name);
> system(buf);

Icky race condition.

What happens if two people log in at once?

> Pretty simple eh?  Alright, now for the fun part.... I can check the file
> (accountownz) on open for eof, however, in doing so, I lose a single
> character to the check.....
> (Which as far as I know in C, is required for an EOF check)
> 
> So, I guess I'm asking, anyone have any tips for checking a blank file
> where I wouldn't lose that head character? (as it is essential for strcmp 
> later
> in the function)
> 
> Or is there anyway to directly get the output from the system call into a
> char* or something, where I could then just parse the information within the
> code itself instead of having to write it to a file?

See popen(3)



Reply via email to