Click here to Skip to main content
15,891,253 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionVisual Studio 2005 (C/C++) Pin
MikeC_124-Oct-07 12:03
MikeC_124-Oct-07 12:03 
AnswerRe: Visual Studio 2005 (C/C++) Pin
Mark Salsbery24-Oct-07 12:30
Mark Salsbery24-Oct-07 12:30 
GeneralRe: Visual Studio 2005 (C/C++) Pin
George L. Jackson24-Oct-07 12:57
George L. Jackson24-Oct-07 12:57 
AnswerRe: Visual Studio 2005 (C/C++) Pin
Peter Weyzen24-Oct-07 13:30
Peter Weyzen24-Oct-07 13:30 
QuestionCannot debug with PDBs Pin
indigox324-Oct-07 11:50
indigox324-Oct-07 11:50 
AnswerRe: Cannot debug with PDBs Pin
Andy Moore25-Oct-07 6:26
Andy Moore25-Oct-07 6:26 
GeneralRe: Cannot debug with PDBs Pin
indigox326-Oct-07 3:32
indigox326-Oct-07 3:32 
QuestionCStdioFile save location to wrong path [modified] Pin
acerunner31624-Oct-07 9:40
acerunner31624-Oct-07 9:40 
I'm trying to save a file to a fixed location. The would like file to be saved in the same folder as the executable, so I am using a relative path. However, I get mixed results. Sometimes it saves to the proper folder, sometimes to desktop, and sometimes to C:\.

If I use an absolute path, the problem goes away. So my question is whether the path specified when opening the file is required to be absolute? And if so, how can I get an absolute path from a relative path not knowing where the executable will be installed?

Here is my code:
CStdioFile LcfIniFile;
CString LcsTempStr;

if (LcfIniFile.Open("test.ini", CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite | CFile::typeText | CFile::shareDenyWrite))
{
     //Process data to be writting to file in LcsTempStr
     ...
     LcfIniFile.WriteString(LcsTempStr);
     LcfIniFile.Close();
}


Thanks.

Edit: MSDN says path can be relative, absolute, or network name. So now I really don't know what I'm doing wrong.
Edit2: I should also note that reading the file using the relative path did not cause any problems, it was only during write.
-- modified at 15:49 Wednesday 24th October, 2007
AnswerRe: CStdioFile save location to wrong path Pin
Peter Weyzen24-Oct-07 9:45
Peter Weyzen24-Oct-07 9:45 
Questionwait for CWinThread to terminate -- from UI thread Pin
Peter Weyzen24-Oct-07 9:27
Peter Weyzen24-Oct-07 9:27 
AnswerRe: wait for CWinThread to terminate -- from UI thread Pin
Peter Weyzen24-Oct-07 9:43
Peter Weyzen24-Oct-07 9:43 
AnswerRe: wait for CWinThread to terminate -- from UI thread Pin
pierre_ribery24-Oct-07 10:45
pierre_ribery24-Oct-07 10:45 
AnswerRe: wait for CWinThread to terminate -- from UI thread Pin
JudyL_MD24-Oct-07 10:51
JudyL_MD24-Oct-07 10:51 
GeneralRe: wait for CWinThread to terminate -- from UI thread Pin
pierre_ribery24-Oct-07 10:59
pierre_ribery24-Oct-07 10:59 
GeneralRe: wait for CWinThread to terminate -- from UI thread Pin
JudyL_MD24-Oct-07 11:09
JudyL_MD24-Oct-07 11:09 
GeneralRe: wait for CWinThread to terminate -- from UI thread Pin
Peter Weyzen24-Oct-07 11:18
Peter Weyzen24-Oct-07 11:18 
AnswerRe: wait for CWinThread to terminate -- from UI thread Pin
Mark Salsbery24-Oct-07 12:18
Mark Salsbery24-Oct-07 12:18 
GeneralRe: wait for CWinThread to terminate -- from UI thread Pin
Peter Weyzen24-Oct-07 13:31
Peter Weyzen24-Oct-07 13:31 
GeneralRe: wait for CWinThread to terminate -- from UI thread Pin
Peter Weyzen31-Oct-07 17:49
Peter Weyzen31-Oct-07 17:49 
QuestionProblem!!! Pin
purplee8524-Oct-07 7:00
purplee8524-Oct-07 7:00 
AnswerRe: Problem!!! Pin
led mike24-Oct-07 7:23
led mike24-Oct-07 7:23 
QuestionRe: Problem!!! Pin
David Crow24-Oct-07 7:30
David Crow24-Oct-07 7:30 
AnswerRe: Problem!!! Pin
jhwurmbach24-Oct-07 22:39
jhwurmbach24-Oct-07 22:39 
QuestionCreating a form at runtime Pin
Demian Panello24-Oct-07 6:23
Demian Panello24-Oct-07 6:23 
QuestionUsing ADO or OLE DB with VC++ Pin
Stevej24-Oct-07 5:54
Stevej24-Oct-07 5:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.