Basado en programación en lenguaje C bajo Linux
#include?lt;unistd.hgt;
#include?lt;sys/types.hgt;
#include?lt;sys/stat. hgt;
#include?lt;fcntl.hgt;
#include?lt;stdio.hgt;
#include?lt;string.hgt;
int
main()
{
int?fd;
char?*?p? =?"hola";
char?buf[256]?=?{0};
if?(-1?!=?(fd?=?open(" ./new.txt",?O_RDWR)))
{
if?(-1?=?write(fd,?p,?strlen(p)))
{
printf("¿ESCRIBIR?OK\n");
}
else
printf ( "WRITE?FAILED\n");
cerrar(fd);
}
if?(-1?!=?(fd?= ? open("./new.txt",?O_RDONLY)))
{
if?(-1?!=?read(fd,?buf,?256) )
printf("LEER:?s\n",?buf);
cerrar(fd);
}
regresar ?0;
}