Deutsch English
Alphabetical index
Array functions
CGI functions
Data types
  • BYTE
  • CHAR
  • INTEGER
  • REAL
  • STRING
  • TBITS
    Date functions
    Debugging
    Fulltext functions
    Language elements
    Numerical functions
    Operators
    Other functions
    Ramtext functions
    Selecting
    Socket functions
    Statistical functions
    Stream functions
    String functions
    System functions
    Table functions
    Text functions
    Home    Overview    Search    Impressum    Contact    Members
    Topic complex Data types
    Function CHAR
    Short Holds exactly one character
    Syntax
    Parameter
    Return
    See also:
    STRING INTEGER REAL BYTE TBITS
    Description A CHAR type variable can hold any character from chr(0) to chr(255). It uses one byte in memory.

    This data type is of special interest at the use in binary stream functions where arrays of CHAR are used.

    Example 1: SMTP-Client

    A SMTP Client

    PROCEDURE send_str(s : INTEGER; l : STRING);
    VAR p : CHAR[1000];
      p[0]:=l+^M+^J; PutSock(s,p,length(l)+2)
      cgiwriteln('> '+l)
    ENDPROC
    PROCEDURE recv_str(s : INTEGER) : STRING;
    VAR p : CHAR[1000];
    VAR i : INTEGER;
    VAR res : STRING;
      nloop(i,GetSock(s,p,1000)-1,res:=res+p[i]);
      RETURN res
    ENDPROC
    
    PROCEDURE Main;
    VAR p : CHAR[1000];
    VAR i : INTEGER;
      cgiclosebuffer;
      cgiwriteln('content-type: text/plain');
      cgiwriteln('');
      IF i:=OpenSock('mail.tdb-engine.de:25') THEN
        cgiwriteln(recv_str(i));
        send_str(i,'HELO mail.tdb.de');
        cgiwriteln(recv_str(i));
        send_str(i,'MAIL FROM:test@tdb-engine.de');
        cgiwriteln(recv_str(i));
        send_str(i,'RCPT TO:test2@tdb-engine.de');
        cgiwriteln(recv_str(i));
        send_str(i,'DATA')
        cgiwriteln(recv_str(i));
        send_str(i,'Das ist ein kleiner Test.');
        send_str(i,'Und das ist die zweite Zeile');
        send_str(i,'.');
        cgiwriteln(recv_str(i));
        send_str(i,'QUIT');
        cgiwriteln(recv_str(i));
        CloseSock(i)
      ELSE
        cgiwriteln('done.')
      END
    ENDPROC
    


    User comments:
    Write a comment:
    Name
    EMail
    Subject
    Text (Switch mode)

    Choose between
    the normal and the
    advanced editor.
    The advanced editor
    runs in IE 5+ and
    Mozilla 1.4+ only
    SPAM-Protection Please enter tdbengine in this field.

    tdbengine chat
    irc.tdbengine.org
    #tdbengine

       Copyright © 2003-2004 tdb Software Service GmbH
       Alle rechte vorbehalten. / All rights reserved
       Last changed: 21.10.2004
    {Fehler für :execmacro{execmacro="sessionspy"}