Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/File-input-output/Octave/file-input-output.octave
Normal file
27
Task/File-input-output/Octave/file-input-output.octave
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue