|Top Previous Next|
What is translated > Special RTL/VCL-functions > I/O routines
Delphi has text and file I/O library routines, which are quite different from C# I/O routines. So they cannot be substituted automatically by according routines of the C# standard library. A direct counterpart of the Delphi in C# was made instead by translation and adaptation of the according parts of the free pascal FCL. It is contained in the files d2c_sysfile.h and d2c_sysfile.cpp in the source folder of the Delphi2C# installation. The GNU Lesser General Public License which apply to the FCL also applies to these files. The translation was made for Windows with the 0x86 processor. The best matching declarations are contained in d2c_system.pas.
With d2c_file.h and d2c_sysfile.cpp the behavior of the Delphi I/O routines is reproduced in C# quite exactly. For example:
t : TextFile;
AssignFile( t, "Test.txt" );
ReWrite( t );
There are differences however in the cases, that Read(Ln)/Write(Ln) routines are called with several arguments and that formatting parameters are appended in the Write(Ln) routines.
The BlockRead and BlockWrite routines only work with plain old data types (POD types), which don't contain pointers to data. In C#, types may not be POD types any longer, which in Delphi are such types. E.g. structures containing Strings will not be POD types in C# any longer.
This page belongs to the Delphi2C# Documentation
|Delphi2C# home Content|