home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
pocketbk
/
utilsr
/
scbank23
/
src
/
writehlp.c
< prev
Wrap
C/C++ Source or Header
|
1994-12-21
|
819b
|
42 lines
#include <stdio.h>
int main(int argc, char **argv)
{
int num,reclen;
char *string,*cp,aline[255];
FILE *fp;
printf("OPLDatabaseFile%c",0x00);
printf("%c%c",0x0f,0x10);
printf("%c%c",0x16,0x00);
printf("%c%c",0x0f,0x10);
/* Write type 2 record*/
printf("%c%c",0x02,0x20);
printf("%c%c",0x00,0x03);
if ((fp=fopen(argv[1],"r"))==NULL)
{
perror(argv[1]);
}
fgets(aline,255,fp);
while (!(feof(fp)))
{
cp=strchr(aline,',');
*cp='\0';
num=atoi(aline);
string=cp+1;
cp=strchr(string,'\n');
*cp='\0';
reclen=strlen(string)+1+2;
printf("%c%c",reclen&0xff,0x10+((reclen&0xf00)>>8));
printf("%c%c",num&0xff,(num&0xff00)>>8);
printf("%c%s",strlen(string),string);
fgets(aline,255,fp);
}
return 0;
}