Ejemplo n.º 1
0
FILE *xmlopen(char *pdir, char *xmlfname)
{
	////int indent = 2 ;
	char sfname[256] ;
	struct tm tm ;
	time_t t ;

	time(&t) ;
	gmtime_r(&t, &tm);

	sprintf(&sfname[0], "lpib%d%02d%02d%02d%02d%02d.xml",
		tm.tm_year+1900 , tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec) ;
	strcpy(xmlfname, sfname) ;

	return(fdiropen(pdir, &sfname[0], "w")) ;
}
Ejemplo n.º 2
0
int savetable(int tableid, unsigned char *pdata, int length)
{
	int rc = 0 ;
	FILE *fp ;
	char tmp[32] ;
	char *pmode ;

	if (tableid == 64) {
		pmode = "ab" ;
	}
	else {
		pmode = "wb" ;
	}

	sprintf(&tmp[0], "tab%03d.dat", tableid) ;
	if ((fp = fdiropen(&outdir[0], &tmp[0], pmode)) != NULL) {
		rc = fwrite(pdata, length, 1, fp) ;
		fclose(fp) ;
	}

	return rc ;
}