home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / HLLAPIC.ZIP / HOST.DOC < prev    next >
Text File  |  1991-08-13  |  2KB  |  70 lines

  1. The enclosed files make the interface to OS/2 Communications Manager in Microsoft C much easier.  The routines have been used with OS/2 EE 1.3 with no problems.
  2.  
  3. The files should be used as follows:
  4.  
  5. HOST.OBJ and HOST.DEF must be included in the make file definition for your program.
  6.  
  7. HOST.H must be included in you C source file.
  8.  
  9. HOST.C is provided so the workbench may recompile it for use in different models.  It should be in the same directory as HOST.OBJ.
  10.  
  11.  
  12.  
  13. A couple examples follow:
  14.  
  15. #include <stdio.h>
  16. #include "HOST.H"
  17. void main( void )
  18. {
  19.     if( host( HostConnect, "A" ))
  20.     {
  21.         printf( "Can not connect to session A" );
  22.         return( 1 );
  23.     }
  24.     if( host( SearchHost, "Logon ID:" ))
  25.     {
  26.         printf( "Host is not ready to receive an ID" );
  27.         return( 2 );
  28.     }
  29.     host( SendKeyToHost, "MyLognID@E" );
  30.     host( WaitForHost, "" );
  31.     if( host( SearchHost, "Password:" ))
  32.     {
  33.         printf( "Host did not ask for password" );
  34.         return( 3 );
  35.     }
  36. ...
  37.  
  38. The above program segment (1) connects to host session "A", (2) looks for a message asking for a logon ID, (3) sends the string "MyLogonID" followed by an enter, (4) waits for the host to unlock the keyboard, (5) checks for a message asking for a password.
  39.  
  40.  
  41.  
  42. #include "HOST.H"
  43. void main( void )
  44. {
  45.     int funcnum,
  46.         infolen,
  47.         errorcode;
  48.     char infostr[80];
  49.  
  50.     if( host( HostConnect, "A" ))
  51.     {
  52.         printf( "Can not connect to session A" );
  53.         return( 1 );
  54.     }
  55.     host( HostDisconnect, "A" );
  56.     funcnum = ReceiveFile;
  57.     errorcode = 1;
  58.     infostr = "a:report.dat A:REPORT SCRIPT A (CRLF ASCII"
  59.     infolen = 42;
  60.     hllapi( &funcnum, infostr, &infolen, &errorcode );
  61. ...
  62.  
  63. The above program segment (1) connects to host session "A", (2) disconnects after checking for errors, (3) sets the variables to download a file with errorcode telling HLLAPI to look on drive A: for the receive command infostr telling HLLAPI to get a file from session A called REPORT SCRIPT A on the host and put in on drive a: as report.dat.  See the Communications Manager manual for more details on the receive command syntax.  The errorcode variable could be checked next to verify the file transfer worked...
  64.  
  65.  
  66. Questions or comments please let me know.
  67.  
  68. OS/2 Shareware: Mark R. Schmidt
  69. Compuserve: 72571,3356
  70.