![]() |
| | #1 |
| Registered User Join Date: Oct 2002
Posts: 27
| How to properly use flock() " warning: passing arg 1 of `flock' makes integer from pointer without a cast" when I try to compile. I am running FreeBSD and using gcc. Code: flock(logfile,LOCK_EX);/*lock log file*/
fputs("client logged in",logfile);
flock(logfile,LOCK_UN);/*unlock log file*/
Code: FILE *logfile; thanks in advance |
| samps005 is offline | |
| | #2 |
| +++ OK NO CARRIER Join Date: Oct 2001
Posts: 10,643
| Read the man page for it. Then actually call it right. It uses a file descriptor. A descriptor is not the same thing as a "FILE*". Quzah.
__________________ Hundreds of thousands of dipshits can't be wrong. Are you up for the suck? |
| quzah is offline | |
| | #3 |
| Registered User Join Date: Oct 2002
Posts: 27
| sorry, I did read the man page for it, I just didn't catch that is was asking for a file descriptor. is there anyway to get the file descriptor from the file pointer? |
| samps005 is offline | |
| | #4 | |
| +++ OK NO CARRIER Join Date: Oct 2001
Posts: 10,643
| Quote:
Quzah.
__________________ Hundreds of thousands of dipshits can't be wrong. Are you up for the suck? | |
| quzah is offline | |
| | #5 |
| Registered User Join Date: Oct 2002
Posts: 27
| yeah, I need the file pointer most of my other code needs it. Does anyone else know of a function to get a file descriptor from a file pointer? Or maybe just another really simple way to lock a file? |
| samps005 is offline | |
| | #6 |
| Registered User Join Date: May 2003
Posts: 15
| stat() might help you -luke
__________________ I'm with <----------- newb! |
| und3rdog is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| fwrite not writing property (or fread not reading properly) | stanlvw | C++ Programming | 3 | 03-05-2009 03:14 AM |
| C++ system("rm") not deleting properly? | fattysmo | C++ Programming | 4 | 05-17-2008 11:37 AM |
| terminal output not showing output properly | stanlvw | C Programming | 13 | 11-19-2007 10:46 PM |
| How to properly use a .lib file? | Kurisu33 | C++ Programming | 6 | 09-28-2006 08:19 PM |
| tic tac toe not working properly | h_howee | Game Programming | 2 | 01-01-2006 01:59 AM |