home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
PROGRAMM
/
SNIP0492.ZIP
/
PCNVRT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-12
|
854b
|
37 lines
/*
** demo code for converting Pascal string to C strings
**
** public domain by Bob Stout
*/
#define Pconvert(s) {int n; n = *s++; s[n] = '\0';}
char *string = malloc(82); /* use instead of string[82] */
fgets(string, 81, inFile); /* get 80-char pascal string */
Pconvert(string); /* convert it in place */
/*
** Warning: The above macro is incompatible with strings that must
** be freed. To avoid this, use the following functions.
**
** public domain by Jan Vroonhof
*/
#include "string.h"
#include "stdio.h"
typedef pastr unsigned char
void pascal ptocstr(char *dest,pastr *org)
{
memcpy(dest,org+1,org[0]);
dest[org[0]]=0;
}
void pascal ctopstr(pastr *dest,char *org)
{
dest[0]=strlen(org);
memcpy(dest+1,org,dest[0]);
}