STREAMFN

Top  Previous  Next

unit Streamfn;

 

interface

Uses

SysUtils, WinTypes, WinProcs, Messages, Classes, Szoveg;

 

function  GByte(tm:Tstream) : byte; far;

function  GLongInt(tm:Tstream) : longint; far;

function  GInteger(tm:Tstream) : integer; far;

function  GSmallInt(tm:Tstream) : Smallint; far;

function  GShortInt(tm:Tstream) : ShortInt; far;

function  GWord(tm:Tstream) : Word; far;

function  GSingle(tm:Tstream) : Single; far;

function  GReal(tm:Tstream) : Real; far;

function  GDouble(tm:Tstream) : Double; far;

function  GExtended(tm:Tstream) : Extended; far;

function  GComp(tm:Tstream) : Comp; far;

function  GString(tm:Tstream;hossz:integer) : string; far;

function  GVarChar(tm:Tstream;hossz:integer) : string;

 

function WriteDataToStream(var tm:Tstream;var v):boolean;

 

var tf: TFileStream;

 

implementation

 

function  GByte(tm:Tstream) : byte;

begin

tm.read(Result,SizeOf(Result));

end;

 

function  GLongInt(tm:Tstream) : longint;

begin

tm.read(Result,SizeOf(Result));

end;

 

function  GInteger(tm:Tstream) : integer;

begin

tm.read(Result,SizeOf(Result));

end;

 

function  GShortInt(tm:Tstream) : ShortInt;

begin

tm.read(Result,SizeOf(Result));

end;

 

function  GSmallInt(tm:Tstream) : SmallInt;

begin

tm.read(Result,SizeOf(Result));

end;

 

function  GWord(tm:Tstream) : Word;

begin

tm.read(Result,SizeOf(Result));

end;

 

function  GSingle(tm:Tstream) : Single;

begin

tm.read(Result,SizeOf(Result));

end;

 

function  GReal(tm:Tstream) : Real;

begin

tm.read(Result,SizeOf(Result));

end;

 

function  GDouble(tm:Tstream) : Double;

begin

tm.read(Result,SizeOf(Result));

end;

 

function  GExtended(tm:Tstream) : Extended;

begin

tm.read(Result,SizeOf(Result));

end;

 

function  GComp(tm:Tstream) : Comp;

begin

tm.read(Result,SizeOf(Result));

end;

 

function  GString(tm:Tstream;hossz:integer) : string;

var s: string;

begin

Result:='';

If hossz>0 then begin

tm.read(s,hossz);

Result := Copy(s,1,Ord(s[0]));

end;

end;

 

function  GVarChar(tm:Tstream;hossz:integer) : string;

var PCH: Array[0..250] of Char;

begin

Result:='';

If hossz>0 then begin

tm.read(PCH,hossz);

Result := Copy(StrPas(PCH),1,hossz);

end;

end;

 

function WriteDataToStream(var tm:Tstream;var v):boolean;

begin

Try

Result := True;

tm.Write(v,SizeOf(v));

except

Result := False;

end;

end;

 

end.