The Question: I recently acquired a 1989 IBM PS2 and I am trying move large files from my newer UNIX-based machine to this IBM via floppy. I have a bash script that splits my files into ~2MB chunks, now I am trying to write a pascal program to reconstruct these files after they have been transferred.
I am unable to find the correct read/write to file methods on this computer. I have tried various pascal tutorial sites, but they are all for newer versions (the site I followed with File Handling In Pascal). I am able to create an empty file (as described below), but I am unable to write to it. Does anyone know the correct pascal read and write methods for this type of computer?
I know this is an obscure question, so thank you in advance for any help you can give me!
The Details:
The current test code that creates a file correctly is 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 is some test code that does not work, the method's append()
and close()
could not be 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 be in the file');
close(outFile);
end.
This is an alternative that also did not work, the writeln()
method only ever prints to the terminal. But otherwise this does 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 be in the file');
close(outFile);
end.
The system: As was previously mentioned, this is a 1989 IBM PS2.
- It has Windows 3.0 installed and can also run DOS and MS-DOS terminals.
- It has Microsoft SMARTDrive Disk Cache version 3.06
- It has Turbo Pascal 5.5 installed and I am using
turbo
as my command line pascal editor. (the readme was last updated in 1989) - It has Turbo debugger 1.5 installed.
Again, I know this is an obscure question, so thank you in advance for any help you can give me!
COPY
can concatenate files, even binary ones using the/B
option. E.g.,COPY File1/B + File2/B File3
. But if you want to do this in Pascal, did you look up file handling in Pascal? – lurkerCOPY
knowledge, I actually did not know that and I'll give it a try (I'm a linux guy)! But I have read that page, it is the first link in the question. I'll change the link title so that it is more apparent, thanks. – Caleb Adamsappend
to concatenate files if you leave the output file open during the whole process. You would only needrewrite
to open the new output file initially for writing. In your second example that compiles, why aren't you usingwriteln(outFile, ...)
as described in the page you linked to? That should work in even the oldest Pascal compilers (it goes back to Niklaus Wirth 1974). How is it that your second example compiles withclose
but your first one can't findclose
? – lurkerappend
function should be available at least as far back as Turbo Pascal 3.0. So when you sayappend
andclose
could not be found, there's something else wrong. The compiler supports them. – lurker