Guys,
what I am trying to accomplish is to catch output from keyboard and direct it to a file:
I am able to compile this perfectly fine. When I execute the binary it asks for input from terminal. file.out is created on local disk but... it is always empty.Code:int main(){ char buffer[128]; int out, len; out = open("file.out", O_CREAT, S_IWUSR|S_IRUSR); len = read(0, &buffer, 128); do { write(out, &buffer, len); } while((len = read(0, &buffer, 128)) >= 128 ); exit(0); }
please advice!!



LinkBack URL
About LinkBacks



