在使用下边函数的时候
GetPrivateProfileStrin("trunkcode","trunk","default",ch,10,"seatdata.ini")
如果seatdata.ini参数不写全路径名的时候,这个文件应该存在什么位置呀,我把它放在debug目录下和源文件目录下,都读不出数据,只有写全路径名的时候就可以得出正确结果,那如果像上边那咱写法,这个文件应该放在什么位置呢?
GetPrivateProfileStrin("trunkcode","trunk","default",ch,10,"seatdata.ini")
如果seatdata.ini参数不写全路径名的时候,这个文件应该存在什么位置呀,我把它放在debug目录下和源文件目录下,都读不出数据,只有写全路径名的时候就可以得出正确结果,那如果像上边那咱写法,这个文件应该放在什么位置呢?
一楼的不要误导群众
[in] Pointer to a null-terminated string that specifies the name of the initialization file. If this parameter does not contain a full path to the file, the system searches for the file in the Windows directory.
楼上说的对,看上边的的解释!
----------------------
如果此 ini 文件是你的配置文件, 则最好放在你的可执行文件所在的目录. 再通过 GetModuleFileName 分析出绝对路径, 然后调用 GetPrivateProfileString
CString sPath;
int nPos;
GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);
sPath.ReleaseBuffer();
nPos=sPath.ReverseFind('\\');
sPath=sPath.Left(nPos);
CString lpszFile=sPath+"\\TD2000.exe";lpszFile就是D:\Test\TD2000.exe