[fpc-pascal] serwrite

Carsten Bager carsten at beas.dk
Wed May 30 18:10:28 CEST 2007


I have written this function where I use serwrite (unit serial). 
If I call 

  serial.serwrite(prn,pchar(f.bufptr),f.bufPos);

like this, it puts out garbage.

How do I trick the compiler not to "convert a pointer to a pointer"?

This works.


Function rs232DeviceInout(var f:textRec):integer32;
Var
 buffer:array[0..79] of char;
Begin
  if f.bufPos<>0 then
  begin
    buffer:=pchar(f.bufptr);
    serial.serwrite(prn,buffer,f.bufPos);
  end;
  f.bufPos:=0;
  rs232DeviceInout:=0;
End;

Carsten
Med venlig hilsen
Carsten Bager

BEAS A/S
Brørupvænget 10
DK-7650 Bøvlingbjerg
Tlf. : +45 9788 5222 Fax : +45 9788 5434
www.beas.dk





More information about the fpc-pascal mailing list