home *** CD-ROM | disk | FTP | other *** search
- /*=======================================================================
-
- PROGRAM FILE: C_CLINE.C
-
- DATE: July 1, 1991
-
- VERSION: 1.01 REVISION DATE:
-
- AUTHOR: Scott D. Heavner
-
- LANGUAGE: MicroSoft Quick C 1.01
-
- COPYRIGHT: 1991, Scott D. Heavner
-
- ======================================================================
-
- DESCRIPTION: C_CLINE is an example of how to use the COMLINE.ASM
- subroutine. The user should determine what flags and
- such he wishes to check for, and incorporate his own
- code. This can be placed as part of a subroutine or
- in the main program.
-
- ==================================================================== */
-
- #include <stdio.h>
- #define CR 13
-
- /* Declare far FORTRAN function with no return value (note capitals) */
- extern void fortran far CLINE();
-
- main()
- {
- /* Declare counter variable */
- int n;
-
- /* Declare far pointer and character array (128 base 0 = 127) */
- char far *ic;
- unsigned char c[127];
- ic = c;
-
- /* Call FORTRAN function using far pointer */
- CLINE(ic);
-
- /* First character contains length of string, print as integer */
- printf("LENGTH = %d\n",c[0]);
-
- /* Step through rest of string and print each character */
- for (n = 1; n <= 127; n++) {
- if (c[n] == CR) /* If Carriage return, print line feed also */
- printf("\n");
- if (n == c[0]+1) /* Show where old input starts */
- printf("End of current input...\n");
- printf("%c", c[n]);
- }
- printf("\n");
- }
-