i had the code like this:-
void Log ::CreateLogFile1()
{
char szDate[12];
char buf[150];
int i=0;
int iLevel;
_strdate( szDate );
strcpy(buf,szLogDir1);
strcat(buf, "\\");
strcat(buf, "\\");
strcat(buf,a);
strcat(buf,szDate);
strcat(buf,".txt");
while(buf[i] != '\0') {
if(buf[i] == '/')
buf[i] = '-';
i++;
}
ofstream pOS(buf,ios::app);
pOS<<"\nBinary Strarted..\n"<<endl;
pOS.close();
}
i modified it as like this:-
void Log ::WriteBinary(char bufg[139])
{
char szDate[12];
char szTime[12];
char buf[2000];
char bufpath[2000];
int i=0;
_strdate( szDate );
_strtime( szTime );
strcpy(buf,szLogDir1);
strcat(buf, "\\");
strcat(buf, "\\");
strcat(buf,a);
strcat(buf,szDate);
strcat(buf,".txt"); memcpy(bufpath,buf,sizeof(buf));
while(buf[i] != '\0')
{
if(buf[i] == '/')
buf[i] = '-';
i++;
}
ofstream pOS(buf,ios::app);
fprintf((FILE*)bufpath, "%s::%s::DATA IS::", szDate, szTime);
fwrite(bufg, 1, 138, (FILE*)bufpath);
fprintf((FILE*)bufpath, "\n");
pOS<<buf<< endl;
pOS.close();
}
my code break at the following line "
fprintf((FILE*)bufpath, "%s::%s::DATA IS::", szDate, szTime);
"
Can anyone tell on this?