07-11-2013
rm uses the unlink system call to "delete" a file. The unlink(2) manual page usually documents the behavior which Don described.
If you also wanted to watch for replacement, you could record the original inode with fstat then monitor the pathname with stat: failure && errno == ENOENT -> file unlinked, success && original_inode != current_inode -> file replaced.
For more efficient but more complicated and unportable monitoring, refer to Linux's inotify or BSD's kqueue.
Regards,
Alister
Last edited by alister; 07-11-2013 at 01:47 PM..
This User Gave Thanks to alister For This Post:
10 More Discussions You Might Find Interesting
1. Programming
I have two string returning function in ESQL/C
char *segment_name(lbuffer)
char *lbuffer;
{.....
and
char *get_bpdvalue(f_name)
char *f_name;
{......
both declared above main()
char *get_bpdvalue();
char *segment_name();
my problem is segment_name works on sprintf and strcpy... (5 Replies)
Discussion started by: jisc
5 Replies
2. Programming
hi all,
my requirement is to create a thread by calling another function.
i.e i dont call pthread_create directly from main, but by calling another function (createThd - below ), from main.
Example:
void *thread_function(void *arg) { /* thread function */
int i;
rc =... (3 Replies)
Discussion started by: wolwy_pete
3 Replies
3. Shell Programming and Scripting
Hi all,
I am very new to BASH shell programming. I need to return an integer from a function to the caller function. I did this:
but it keeps giving me wrong return:
Can someone help me out here, please?
Thanks (2 Replies)
Discussion started by: alirezan
2 Replies
4. Programming
hi
how can I return multiple values from a C function. I tried the following:
#include <stdio.h>
void foo(int id, char *first_name, char *last_name)
{
/*
this is just an example to illustrate my problem... real code makes
use of the "id" parameter.
*/
first_name = (char... (8 Replies)
Discussion started by: Andrewkl
8 Replies
5. Shell Programming and Scripting
Hi All
In my script, I can call on several functions. I have a logging function that is called by any of these functions. What I would like is some way of identifying which function I am using and pass this to the log function as some parameter.
Is there some built in command or way of... (3 Replies)
Discussion started by: kingpin2502
3 Replies
6. Programming
Hi,
my code is written in proC and it is in UNIX(AIX).I have written a small code for writing data into a binary file,but while writing my program is giving core dump.
Here Is my code----
fpWriteFile = fopen(WriteFileName,"wb+");
CHAR *recvgen;
recvgen = (char... (7 Replies)
Discussion started by: ajaysahoo
7 Replies
7. Programming
I am working on the application in which I have to fetch values from the database and paste in url and send it to portal.
table=get_result("SELECT serialno,cas,Mode,FLC,TLC,location,CompName,CompCode,FG,FC,DispNo,TruckNo,LWbill,RRGPN,INVNO,DCN,RQTY,DQTY,SQTY,DDATE,RDATE,SDATE,TTIME FROM... (1 Reply)
Discussion started by: er.rohan88
1 Replies
8. Programming
Hi guys.
how a functions such fdopen, ... can return pointer?
are these functions use static memory(variables)? (6 Replies)
Discussion started by: majid.merkava
6 Replies
9. Shell Programming and Scripting
Below is a flowchart of a program. Most everything works as expected, but there are a couple of issues that I need some expert help on. The check function was setup initially for a single user input. The input has been modified to allow for multiple inputs, so the code below does not work. My... (15 Replies)
Discussion started by: cmccabe
15 Replies
10. UNIX for Dummies Questions & Answers
I have some matlab code that sends the serial port elements of an array using matlab's fwrite function, e.g.:
fwrite(s, , 'uchar');
What would be a unix shell equivalent? E.g., after successfully accessing the port using instructions here:
Simple terminal serial port program for Linux/MacOSX... (3 Replies)
Discussion started by: darwin_886
3 Replies
FREAD(3) BSD Library Functions Manual FREAD(3)
NAME
fread, fwrite -- binary stream input/output
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdio.h>
size_t
fread(void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);
size_t
fwrite(const void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);
DESCRIPTION
The function fread() reads nitems objects, each size bytes long, from the stream pointed to by stream, storing them at the location given by
ptr.
The function fwrite() writes nitems objects, each size bytes long, to the stream pointed to by stream, obtaining them from the location given
by ptr.
RETURN VALUES
The functions fread() and fwrite() advance the file position indicator for the stream by the number of bytes read or written. They return
the number of objects read or written. If an error occurs, or the end-of-file is reached, the return value is a short object count (or
zero).
The function fread() does not distinguish between end-of-file and error; callers must use feof(3) and ferror(3) to determine which occurred.
The function fwrite() returns a value less than nitems only if a write error has occurred.
SEE ALSO
read(2), write(2)
STANDARDS
The functions fread() and fwrite() conform to ISO/IEC 9899:1990 (``ISO C90'').
BSD
March 8, 1994 BSD