The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Checking for a file in file pattern before deleting it dsrookie UNIX for Dummies Questions & Answers 1 05-09-2008 01:29 PM
Deleting lines inside a file without opening the file toms Shell Programming and Scripting 3 09-24-2007 04:58 AM
Remove the contents of a file without deleting the file sumesh.abraham Shell Programming and Scripting 10 12-02-2006 02:35 PM
Deleting a file I don't own kumachan UNIX for Dummies Questions & Answers 5 09-19-2003 07:50 AM
Deleting log file s_aamir UNIX for Advanced & Expert Users 5 01-07-2002 08:05 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 11-13-2006
Registered User
 

Join Date: Oct 2004
Posts: 235
Zero bye file not deleting

Hi All...

The code i have written is

if(filename)
remove_files (filename);

and my remove function is
=========================================
void remove_files(char *rf)
{
if (remove(rf)==0)
printf("(%d) Deleting %s\n",getpid(), rf); // JC 10/24/2003
else
printf("(%d) Cannot delete %s\n",getpid(), rf);// JC 10/24/2003
}
=========================================================

The problem is if the file to be removed is a zero byte file it is not deleting . Please let me know how can i delete the zero byte file and let me know why remove is not removing zero byte file and how can i remove it ..


Thanks in advance,
Arun Kumar
Reply With Quote
Forum Sponsor
  #2  
Old 11-13-2006
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
Do you know the filename that the error is being thrown for? If you do, just run the command:
Code:
fuser -fu "full_path_to_filename"
This will show you the pid for any process has that file open. If you do get the pid, check for that using the 'ps' command and find if you can terminate that process. The file should get deleted after you kill the process.
Reply With Quote
  #3  
Old 11-14-2006
Registered User
 

Join Date: Oct 2004
Posts: 235
Thanks working
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:38 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0