Ejemplo de código fuente de scopiar.c¶
Construído con la interfaz de llamadas al sistema de C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /**
* @file scopiar.c
* @author G.A.
* @date 21 Jan 2018
* @brief Simplified version of cat command (without arguments). The source code use the Linux system calls interface
*
*/
#include <unistd.h>
#define TAMANO_BUFFER 512
int main(int argc, char *argv[])
{
int n;
char buf[TAMANO_BUFFER];
while ((n= read(0, buf, TAMANO_BUFFER)) > 0)
write(1, buf, n);
return 0;
}
|