I was trying to write a shell program(in c) and came across the following problem. Can any one please tell me how can I save the output of an echo in to a file. For example, some one might type in echo document_this > foo1 then I want to save document_this in to a file name foo1.
if(strcmp(myargv[0],"echo") == 0)
{
printf("Saving: %s in to a file", myargv[1]);
.
.
.
}
Any help would be greatly appreciated. can't use #include <fstream>, anything else I should use? Thanks.