[LC++]Copying files and deleting directories

Jan Pfeifer pfjan at yahoo.com.br
Thu Sep 9 04:38:05 UTC 2004


there is no system call or standard c library function to copy files. To 
avoid researching about ideal buffer sizes and whatever other details 
that may be involved in copying files -- the source for the gnu cp 
program is quite big --, I'd recommend using:

/* see "system" c function: man 3 system */
system( "/bin/cp source_file target_file" );

unfortunately this solution is probably not portable outside the unix 
environment. But then, this is a linux-c++ list :)

best luck,

jan




Krishna Monian wrote:

>Hi All, 
>I have a very simple problem to solve, but am not
>having too much luck with it.
>
>What is the function call to copy files under C/C++?
>What is the function call to delete files and
>directories under C/C++?
>
>Thanks
>Krishna Monian
>
>
>		
>__________________________________
>Do you Yahoo!?
>New and Improved Yahoo! Mail - Send 10MB messages!
>http://promotions.yahoo.com/new_mail 
>
>_______________________________________________
>This is the Linux C++ Programming List
>: http://lists.linux.org.au/listinfo/tuxcpprogramming List
>
>  
>





More information about the tuxCPProgramming mailing list