Data STRING sending to serialComm

damian177
2022-03-21
2022-03-22
  • damian177 - 2022-03-21

    Hi,
    I send String data to serial com to thermal printer like this:

    sw1: STRING:= 'DATA:';
    
    dwWritten := SysComWrite(hCom:= hCom, pbyBuffer:= ADR(sw1), ulSize:= SIZEOF(sw1), ulTimeout:= 100, pResult:= ADR(Result) );
    

    When I do not change my data in sw1 variable - everything is ok.

    When I change my data and send to serial com like this:

    sw1:= '12';
    dwWritten := SysComWrite(hCom:= hCom, pbyBuffer:= ADR(sw1), ulSize:= SIZEOF(sw1), ulTimeout:= 100, pResult:= ADR(Result) );
    

    Result on printer is bad , because I get on my printer my chars with "bushes" .... How can I change SIZE of my variable to send?

     
  • TimvH

    TimvH - 2022-03-22

    IF your string will remain less than 255 characters (which should be, because you defined it as standard string, so this will be max 80), then you can use the function LEN(sw1).

     
  • damian177 - 2022-03-22

    right,
    thanks.

     

Log in to post a comment.