c - How can I use Linux's splice() function to copy a file to another file? -


Here is another question about the bench (). I am hoping to use it to copy files, and I am trying to use two splice calls joining the pipes, such as the example on the Wikipedia page of the wedding. I wrote a simple test case that reads the 32 bytes just before one file and tries to write them in the other:

  #define _GNU_SOURCE #include & lt; Fcntl.h & gt; # Include & lt; Stdio.h & gt; # Include & lt; Unistd.h & gt; # Include & lt; Errno.h & gt; #include & lt; String.h & gt; Int main (int argc, char ** argv) {int pipefd [2]; Full result; FILE * in_file; File * out_file; Results = pipe (pipe); In_file = fopen (argv [1], "rb"); Out_file = fopen (argv [2], "wb"); Results = Partition (Filino (In_File), 0, PipPyD [1], Faucet, 32768, SPLICMFMear | SPLICIMFAMOEF); Printf ("% d \ n", result); Result = Benzene (Pipid [0], Faucet, Fino (Out_file), 0, 32768, SPLICM FMM | SPLICIMFAMOEF); Printf ("% d \ n", result); If (result == -1) printf ("% d -% s \ n", error, strerror (errno)); Closer (pipefd [0]); Closer (pipefd [1]); Fclose (in_file); Fclose (out_file); Return 0; }  

When I run it, the input file is read correctly, but the second square calls fail, this ANINVL nobody knows what I'm doing wrong here ?

Thank you!

How are you copying the file system from /?

Your example runs on my system when both files are on the ex3, but when I use an external drive (I forget that it is DOS or NTFS). My guess is that one or both of your files are on a file system that does not support Bantua.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -