Sorry guys for the terribly basic question.
I need to open, read and write information from and to a standard file.
Atm I am just trying to write the info to stderr to test if its working but to no avail.
I'm sure there's something very basic I am doing wrong but I havnt been able to find any decent example to show me.
Here is my code:
Code:
FILE * ffp;
/* Open Files */
ffp = open(firstpath, O_RDONLY);
/* check file opened succesfully */
if(ffp == -1)
{
fprintf(stderr, "Error opening first file\n");
exit(1);
}
while(read(ffp, input_buffer, BUFFER) != -1)
{
write(stderr, &input_buffer, sizeof(input_buffer));
}
The read command is always returning -1.
This is running on a Solaris machine just so you know.
Thanks for any help.