the question: acquired 1989 ibm ps2 , trying move large files newer unix-based machine ibm via floppy. have bash script splits files ~2mb chunks, trying write pascal program reconstruct these files after have been transferred.
i unable find correct read/write file methods on computer. have tried various pascal tutorial sites, newer versions (the site followed file handling in pascal). able create empty file (as described below), unable write it. know correct pascal read , write methods type of computer?
i know obscure question, thank in advance can give me!
the details:
the current test code creates file correctly this:
program testingfiles; uses crt, win; const file_name = 'testfile.txt'; var outfile : file; begin writeln('creating file ...'); assign(outfile, file_name); rewrite(outfile); end.
this test code not work, method's append()
, close()
not found:
program testingfiles; uses crt, win; const file_name = 'testfile.txt'; var outfile : file; begin writeln('creating file ...'); assign(outfile, file_name); append(outfile); writeln('this should in file'); close(outfile); end.
this alternative did not work, writeln()
method ever prints terminal. otherwise compile.
program testingfiles; uses crt, win; const file_name = 'testfile.txt'; var outfile : file; begin writeln('creating file ...'); assign(outfile, file_name); rewrite(outfile); writeln('this should in file'); close(outfile); end.
the system: mentioned, 1989 ibm ps2.
- it has windows 3.0 installed , can run dos , ms-dos terminals.
- it has microsoft smartdrive disk cache version 3.06
- it has turbo pascal 5.5 installed , using
turbo
command line pascal editor. (the readme last updated in 1989) - it has turbo debugger 1.5 installed.
again, know obscure question, thank in advance can give me!
my pascal memory rusty... other have pointed out, here should consider:
program testingfiles; uses crt, system; //no need of importin win win windows enviorment, i'm not sure if need use system, sysutils or there dos class??? const file_name = 'testfile.txt'; var outfile,infile : file; begin writeln('creating file ...'); assign(outfile, file_name); rewrite(outfile); //now open first chunk of file want concatenate assignfile(infile, "fisrt_chunk.dat"); reset(infile); while not eof(infile) begin readln(infile, s); writeln(outfile,s); end; close(infile); end.
i don't have turbo/borland pascal installed longer couldn't compile myself, no promise work more idea:
- key thing remember, readln , writeln add return @ end of string/line, read , write on other hand leave cursor wherever without jumping new line.
Comments
Post a Comment