09-07-2007
Quote:
Originally Posted by
blowtorch
Sorry for the delayed reply. Truncate does not mean closing the file, the file will still be open and the process will still be writing to it. But the size of the file will be reduced to zero bytes (it will increase again when the process that is writing to the files does a write).
could you please give me an example with truncate to make it clear, because I am not sure how to use it ?
besides, is there any way to close a file that is open ?
thanks.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Is there any commands in UNIX, like isopen(),isclose() to know whether a file has been opened for read/write purpose.?
Thanks (3 Replies)
Discussion started by: Pal
3 Replies
2. UNIX for Dummies Questions & Answers
I have a UNIX daemon process that's been started by a parent process, an application server.
The behavior of this daemon process is to inherit and use the app
server's file descriptors (ports/sockets).
When I shutdown the app server, the daemon continues to run, because there may be other... (1 Reply)
Discussion started by: kunalashar
1 Replies
3. UNIX for Advanced & Expert Users
I am having a client/server application which will download files from server. If server has directories, it will create directories/sub directories and then download files. In this process, I observed that number of open files are more than 400 (which is approxmately same as number of dir/subdir... (1 Reply)
Discussion started by: satyam90
1 Replies
4. Windows & DOS: Issues & Discussions
I'm trying to setup a cron job for my brother that goes out to the web and retrieves an excel file and overwrites the existing copy on his desktop. The problem I'm facing is I have to kill the process (excel.exe) if the file is open while the batch file runs, otherwise, it will create another copy... (2 Replies)
Discussion started by: quattro20v
2 Replies
5. Solaris
Hi
want to know what file (descriptor+filename+socket) is being accessed by particular process on solaris.
Purpose : while running perf. test, needs to find where is the bottleneck.
We are providing concurrnet load for around 1 hr and needs to capture data related to file usage pattern... (1 Reply)
Discussion started by: raxitsheth
1 Replies
6. Programming
can someone provide an example, where if the parent process quits for any reason, then the child process will also close? (3 Replies)
Discussion started by: omega666
3 Replies
7. IP Networking
Hi,
I have read some forum theads about the open and close ports. some points are clear and it is not working on my machine or something am i missing?
I have commented out a port /etc/services, one application uses
then when i use the telnet <hostname> <port_blocked> it shows connected..... (1 Reply)
Discussion started by: balamv
1 Replies
8. Shell Programming and Scripting
Hi all,
I need a script to delete a large set of files from a directory under / based on an input file and want to redirect errors into separate file.
I have already prepared a list of files in the input file.
Kndly help me.
Thanks,
Prash (36 Replies)
Discussion started by: prash358
36 Replies
9. Shell Programming and Scripting
I would like to create the following script:
run a python script with setsid
python may or may not fail with exception
check if all of the group processes were terminated correctly
if not, kill the remaining processes
How can I do that?
Thanks a lot (3 Replies)
Discussion started by: ASF Studio
3 Replies
10. Shell Programming and Scripting
Hi Gurus,
I have an input like the one below. What i wanted to achieved is to create a select statement based from that information
INPUTInsert into table_name (col1,col2,col3,col4,col5,DATE1,DATE2,col6,col7,col8,col9,col10,col11) values (6752,14932156,24,'ALL','Staff',to_date('04/17/2017... (6 Replies)
Discussion started by: ernesto
6 Replies
fclose(3S) fclose(3S)
NAME
fclose(), fflush(), fclose_unlocked(), fflush_unlocked() - close or flush a stream
SYNOPSIS
Obsolescent Interfaces
DESCRIPTION
causes any buffered data for the named stream to be written out, and the stream to be closed. Buffers allocated by the standard input/out-
put system may be freed.
is performed automatically for all open files upon calling exit(2).
If stream points to an output stream or an update stream in which the most recent operation was output, causes any buffered data for the
stream to be written to that file; otherwise any buffered data is discarded. The stream remains open.
If stream is a null pointer, performs this flushing action on all currently open streams.
Obsolescent Interfaces
and close or flush a stream.
RETURN VALUE
Upon successful completion, and return 0. Otherwise, they return EOF and set to indicate the error.
ERRORS
If or fails, is set to one of:
The flag is set for the file descriptor underlying stream and the process would be delayed in the write operation.
The file descriptor underlying
stream is not valid.
An attempt was made to write a file
that exceeds the process's file size limit or the maximum file size (see ulimit(2)).
or was interrupted by a signal.
The process is in a background process group
and is attempting to write to its controlling terminal, is set, the process is neither ignoring nor blocking the signal,
and the process group of the process is orphaned.
There was no free space remaining on the device containing the file.
An attempt was made to write to a pipe
that is not open for reading by any process. A signal is also sent to the process.
Additional values may be set by the underlying and functions (see write(2), lseek(2) and close(2)).
WARNINGS
and are obsolescent interfaces supported only for compatibility with existing DCE applications. New multithreaded applications should use
and
SEE ALSO
close(2), exit(2), lseek(2), write(2), flockfile(3S), fopen(3S), setbuf(3S), thread_safety(5).
STANDARDS CONFORMANCE
fclose(3S)