home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
printer
/
laser.arc
/
BIN_TEST.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-03-27
|
2KB
|
53 lines
Program Bin_test;
{This program test the ability of the plotting program to handle
binary data files.}
Var
Data_file: File of real;
I: Integer;
J: Integer;
No_of_lines: Real;
No_of_points: Real;
Data: Real;
Negative_one: Real;
Zero: Real;
Header1: String[50];
Header2: String[50];
RealOrd: Real;
Begin
Negative_one := -1.0;
Zero := 0.0;
Header1 := 'Binary data file: example data';
Header2 := '(This label is included in the data file)';
No_of_lines := 2.0;
No_of_points := 5.0;
Assign(Data_file, 'Bin_test.dat');
Rewrite(Data_file);
{This section shows the method by which a label may be placed in a binary
data file. It could be omitted entirely and the program would still work.}
Write(Data_file, negative_one); {indicates a label is in the file}
For I:=1 to Length(Header1) do {Write header 1}
Begin
RealOrd := Ord(Header1[I]); {Find a real number which is the}
Write(Data_file, RealOrd); { ascii value for the character}
End;
Write(Data_file, Zero); {Indicates the end of header1}
For I:=1 to Length(Header2) do {Write header 2}
Begin
RealOrd := Ord(Header2[I]); {Find a real number which is the}
Write(Data_file, RealOrd); { ascii value for the character}
End;
Write(Data_file, Zero); {Indicates the end of header2}
Write(Data_file, No_of_lines);
Write(Data_file, No_of_points);
For I:=1 to Round(No_of_lines) do
For J:=1 to Round(No_of_points) do
Begin
Data := 1.0 * I / J;
Write(Data_file, Data);
End;
Close(Data_file);
End.