home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / fortran / library / comline / c_cline.c < prev    next >
C/C++ Source or Header  |  1991-07-01  |  2KB  |  57 lines

  1. /*=======================================================================
  2.   
  3.     PROGRAM FILE:  C_CLINE.C
  4.  
  5.     DATE:  July 1, 1991  
  6.  
  7.     VERSION:  1.01                      REVISION DATE:              
  8.  
  9.     AUTHOR:  Scott D. Heavner 
  10.  
  11.     LANGUAGE: MicroSoft Quick C 1.01
  12.  
  13.     COPYRIGHT:  1991, Scott D. Heavner
  14.  
  15.   ======================================================================
  16.  
  17.     DESCRIPTION:  C_CLINE is an example of how to use the COMLINE.ASM
  18.                   subroutine.  The user should determine what flags and
  19.                   such he wishes to check for, and incorporate his own
  20.                   code.  This can be placed as part of a subroutine or
  21.                   in the main program.
  22.  
  23.  ==================================================================== */
  24.  
  25. #include <stdio.h>
  26. #define CR 13
  27.  
  28. /* Declare far FORTRAN function with no return value (note capitals) */
  29. extern void fortran far CLINE();
  30.  
  31. main()
  32. {
  33.    /* Declare counter variable */
  34.    int n;
  35.    
  36.    /* Declare far pointer and character array (128 base 0 = 127) */
  37.    char far *ic;
  38.    unsigned char c[127];
  39.    ic = c;
  40.    
  41.    /* Call FORTRAN function using far pointer */
  42.    CLINE(ic);
  43.    
  44.    /* First character contains length of string, print as integer */
  45.    printf("LENGTH = %d\n",c[0]);
  46.    
  47.    /* Step through rest of string and print each character */
  48.    for (n = 1; n <= 127; n++) {
  49.       if (c[n] == CR)  /* If Carriage return, print line feed also */
  50.          printf("\n");
  51.       if (n == c[0]+1)   /* Show where old input starts */
  52.          printf("End of current input...\n");
  53.       printf("%c", c[n]);
  54.       }
  55.    printf("\n");
  56. }
  57.