home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_C
/
SNPD9404.ZIP
/
PCNVRT.C
< prev
next >
Wrap
Text File
|
1994-04-03
|
548b
|
21 lines
.I 0 2
/*
** demo code for converting Pascal strings to/from C strings
.D 1 2
.I 8 3
typedef unsigned char UCHAR;
#define P2Cconvert(s) {UCHAR n = *(s); memmove((s), &(s)[1], n); s[n] = '\0';}
.D 9 1
.I 11 9
#if (0) /* Demo code fragment follows */
char string[81];
fgets(string, 81, inFile); /* get 80-char pascal string */
P2Cconvert(string); /* convert it in place */
C2Pconvert(string); /* convert back */
#endif
.D 12 5