Do External in C

Richard Sheehan sheerich@isu.edu
Mon, 22 Oct 2001 12:11:20 -0600


Hello lister's

I'm just checking here before I contact Cognos on this question.

Environment:
HP3000 SERIES 969-400
MPE/iX C.60.02
PowerHouse  8.29.D3

In the QDESIGN manual under DO EXTERNAL, there is the following example:

The screen design is as follows:
> SCREEN QKCHANGE MENU
> TEMPORARY ARGUMENT CHARACTER*15
.
.
.
> BEGIN
> DO EXTERNAL CHANGE (ARGUMENT)
> DISPLAY ARGUMENT
> END
> BUILD

The C routine to accept the temporary item is as follows:

extern char *memcpy();
extern int memcmp();
void change( value )
char *value; /* Reference of argument as
* to byte ptr.
*/
{
if( ( memcmp( value, "Hello World", 11 )) == 0)
(void)memcpy( value, "Hello Quick", 11 );
else
(void)memcpy( value, "GoodBye Quick", 13 );
}

I have this working under MPE/iX, but I want to determine the size of
value.

Does the memory allocated for strings end the the null character \0?
This appears to be the case, but I just want to make sure.

Code will be more flexible if it can determine the size of the strings
passed in with strlen,
and do dynamic memory allocation for strings to work with than to build
for a maximum size string.

TIA,

-- 
Richard Sheehan,
Administrative Systems - IT Programmer Analyst
Idaho State University Computing & Communications
Campus Box 8037, Pocatello, ID 83209-8037
Phone: 208.282.3861 - Fax: 208.282.3673
Email: sheerich@isu.edu