65 lines
1.7 KiB
C
Executable File
65 lines
1.7 KiB
C
Executable File
/******************************************************************************
|
|
*
|
|
* GCI example .c file - argument passing
|
|
*
|
|
* Module %M% Version %I% Date %H%
|
|
*
|
|
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
|
|
* This is unpublished proprietary source code of Ardent Software Inc.
|
|
* The copyright notice above does not evidence any actual or intended
|
|
* publication of such source code.
|
|
*
|
|
*******************************************************************************
|
|
*
|
|
* Maintenence log - insert most recent change descriptions at top
|
|
*
|
|
* Date.... GTAR# WHO Description.........................................
|
|
* 10/14/98 23801 SAP Change copyrights.
|
|
* 05/23/90 6933 DTW move include stuff
|
|
* 02/19/90 -- DTW New file
|
|
*
|
|
******************************************************************************/
|
|
#include <gci.h>
|
|
|
|
/*
|
|
* a subroutine to demonstrate data passing both ways
|
|
* (BASIC to C and back, C to BASIC).
|
|
*
|
|
* arguments: arg1 = pointer to character string pointer
|
|
* arg2 = pointer to an integer
|
|
* return value: void
|
|
* See the GCI manual for more information.
|
|
*/
|
|
void
|
|
passing(arg1, arg2)
|
|
char **arg1;
|
|
int *arg2;
|
|
{
|
|
/*
|
|
* display what we got
|
|
*/
|
|
printf("This is inside the C routine.\n");
|
|
printf("arg1 is a string equal to '%s'.\n", *arg1);
|
|
printf("arg2 is an integer equal to '%d'.\n", *arg2);
|
|
|
|
/*
|
|
* change what we got for demonstration porpoises only
|
|
*/
|
|
(void)strncpy(*arg1, "after passing", strlen(*arg1));
|
|
*arg2 = -999;
|
|
|
|
/*
|
|
* display what we changed
|
|
*/
|
|
printf("\n");
|
|
printf("The C routine has changed arg1 to '%s'\n", *arg1);
|
|
printf("and changed arg2 to '%d'.\n", *arg2);
|
|
|
|
/*
|
|
* bring it all home
|
|
*/
|
|
printf("Now let's return to BASIC.\n");
|
|
return;
|
|
}
|
|
|