File input/output: Difference between revisions

Content added Content deleted
(added language octave)
Line 1,715: Line 1,715:


(Notice that ic and oc, of type ''in_channel'' and ''out_channel'', are buffered)
(Notice that ic and oc, of type ''in_channel'' and ''out_channel'', are buffered)

=={{header|Octave}}==
<lang octave>
in = fopen("input.txt", "r", "native");
out = fopen("output.txt", "w","native");
if (in == -1)
disp("Error opening input.txt for reading.");
else
if (out == -1)
disp("Error opening output.txt for writing.");
else
while (1)
[val,count]=fread(in,1,"uchar",0,"native");
if (count > 0)
count=fwrite(out,val,"uchar",0,"native");
if (count == 0)
disp("Error writing to output.txt.");
end
else
break;
end
endwhile
end
end
if (in != -1)
fclose(in);
end
if (out != -1)
fclose(out);
end
</lang>


=={{header|OpenEdge/Progress}}==
=={{header|OpenEdge/Progress}}==