ansistring a1="12345",a2="67890" ;
int Length,LogHandle ;
Length = strlen(a1.c_str());
LogHandle = open("c:\a.log",O_RDWR | O_APPEND | O_TEXT) ;
write(LogHandle,a1.c_str(),Length);
close(LogHandle) ;
LogHandle = open("c:\a.log",O_RDWR | O_APPEND | O_TEXT) ;
Length = strlen(a2.c_str());
write(LogHandle,a2.c_str(),Length );
close(LogHandle) ;
结果:
1234567
890
我要得结果:
12345
67890
怎么改?可得到我要得结果。
AnsiString a1="12345",a2="67890" ;
int Length,LogHandle ;
Length = strlen(a1.c_str());
LogHandle = open("c:\\a.log", O_RDWR | O_APPEND | O_TEXT) ;
write(LogHandle,a1.c_str(),Length);
close(LogHandle) ;
LogHandle = open("c:\\a.log", O_RDWR | O_APPEND | O_TEXT) ;
Length = strlen(a2.c_str());
write(LogHandle,"\n",1); //这里插个换行进去就行了
write(LogHandle,a2.c_str(),Length );
close(LogHandle);