Sun Microsystems SunSoft Pascal 4.0 User Manual page 167

Hewlett-packard user guide printer printer
Table of Contents

Advertisement

The C++ main program,
StrRefMain.cc
The commands to compile and
execute StrRef.p and
StrRefMain.cc
#include <stdio.h>
#include <string.h>
struct TVarLenStr {
int NBytes;
char a[25];
};
extern "C" void StrRef (
char
*,
char
*,
TVarLenStr &);
int main(void)
{
struct TVarLenStr vls;
char s10[10],
s80[80],
s25[25];
vls.NBytes = 0;
StrRef (s10, s80, vls);
strncpy (s25, vls.a, vls.NBytes);
printf (" s10 = '%s' \n s80 = '%s' \n s25 = '%s' \n",
s10,
printf (" strlen (s25) = %d \n", strlen(s25));
}
hostname% pc -c StrRef.p
hostname% CC StrRef.o StrRefMain.cc -lpc
hostname% a.out
s10 = 'abcdefghi'
s80 = 'abcdefghijklmnopqrstuvwxyz'
s25 = 'varstr'
strlen (s25) = 6
The C++–Pascal Interface
s80,
s25);
7
143

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the SunSoft Pascal 4.0 and is the answer not in the manual?

Questions and answers

Table of Contents