LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-13-2005, 05:33 AM   #1
monil
LQ Newbie
 
Registered: Mar 2005
Posts: 19

Rep: Reputation: 0
Deleting files in C


Hi,

Is it possible to delete files in the current working directory from c ?

is there any finction like file_delete() that deletes a file?

Pls help

-Monil
 
Old 03-13-2005, 05:40 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724
Of course:
int unlink(const char *pathname);
or
int remove(const char *pathname);

man 2 unlink
man 3 remove

Last edited by keefaz; 03-13-2005 at 05:42 AM.
 
Old 03-13-2005, 10:31 AM   #3
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
however, those are unportable (at least they're not ANSI compliant--but they're probably posixly correct); a `remedy' for that would be to wrap it up in a fuction that makes the appropriate call; then it's easier to change if you want to port it.
 
Old 03-13-2005, 11:24 AM   #4
Hivemind
Member
 
Registered: Sep 2004
Posts: 273

Rep: Reputation: 30
remove() is ISO C. unlink() is not.
 
Old 03-13-2005, 11:33 AM   #5
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
sorry; my bad.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting files from ntfs obscure-shadow Linux - Software 7 06-29-2005 02:01 AM
recovering deleting files scarr3d Debian 1 03-12-2005 08:27 PM
Deleting files! a_priebe47 Slackware 6 10-17-2004 10:58 PM
Deleting files ShakyJake Linux - Newbie 12 05-08-2003 04:07 PM
Deleting files Tingle Linux - Newbie 4 01-16-2003 05:19 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration