|
Question : CString in fprintf
|
|
A quick question... I am trying to log message into a file of a CString... it keeps giving me assert error... What is going on here?
Here is the sample
CString PTR pString = "asdfasdf"; FILE *p = fopen("tmp.log", "a"); fprintf(p, "%s\n", (LPCTSTR)pString ); close(p);
Assert error happens at fprintf, "str!=null"
Have you seen this before?
|
|
Answer : CString in fprintf
|
|
>>Does DLL has some specially requirement to open a file?
No.
Two most common reasons for not being able to open a file are:
1) File not there. You are using a RELATIVE pathname. If the current directory is NOT where the file is this will fail. Check your current dir while running and make sure you are right. Change it if you have to or use an ABSOLUTE pathname instead.
2) Lack of permissions to open the file.
|
|
|