If you want to just check to see if the file exists use access(), then open it.
BTW, if you can use execl() instead of system(), less of a performance hit. > -----Original Message----- > From: Jamie Harrell [mailto:[EMAIL PROTECTED] > Sent: Monday, February 04, 2002 3:36 PM > To: [email protected] > Subject: system() > > > Hey all, long time since I've asked anything here, but here goes... ;) > > I'm performing a character-locking sequence on my mud, where I allow > people to have a single account, with all of their characters > associated > with that. > > Therefore, I've modified the playerfile format, to allow for locking, > the new naming policy is: > > playername.accountname > > These are still located within the /player/ folder. > > Now, more to my question. > > When someone attempts to sign on, to allow for realtime checking, I > am doing a system() call like such: > > sprintf(buf, "ls %s/%s.* > accountownz", PLAYER_DIR, lookup_name); > system(buf); > > 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? > > Hope this makes sense, if not, feel free to ask away, I can > explain further... > > Thanks for your time reading, > -- > Jamie Harrell | [EMAIL PROTECTED] > | URL: http://icechild.dhs.org > ICQ: 2985611 | AIM: Liquidicie > -- > "A computer scientist is someone who, when told to 'Go to Hell', > sees the 'go to', rather than the destination, as > harmful." > -- > > > -- > ROM mailing list > [email protected] > http://www.rom.org/cgi-bin/mailman/listinfo/rom >

