Click here to Skip to main content
15,902,811 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionOpen a .txt file with a press of a button in MFC Pin
lahom3-May-08 8:28
lahom3-May-08 8:28 
AnswerRe: Open a .txt file with a press of a button in MFC Pin
JudyL_MD3-May-08 10:44
JudyL_MD3-May-08 10:44 
AnswerRe: Open a .txt file with a press of a button in MFC Pin
Ozer Karaagac3-May-08 11:50
professionalOzer Karaagac3-May-08 11:50 
AnswerRe: Open a .txt file with a press of a button in MFC Pin
Hamid_RT3-May-08 18:21
Hamid_RT3-May-08 18:21 
AnswerRe: Open a .txt file with a press of a button in MFC Pin
ThatsAlok4-May-08 23:57
ThatsAlok4-May-08 23:57 
QuestionDevelop virtual environment online using C# with Managed DirecX? Pin
katelva3-May-08 8:18
katelva3-May-08 8:18 
AnswerStop bombing the boards Pin
Pete O'Hanlon3-May-08 9:02
mvePete O'Hanlon3-May-08 9:02 
AnswerRe: Develop virtual environment online using C# with Managed DirecX? Pin
Cranky3-May-08 12:39
Cranky3-May-08 12:39 
QuestionHow I can MIX the Sounds from network(directsound) Pin
doudou-shen3-May-08 4:57
doudou-shen3-May-08 4:57 
AnswerRe: How I can MIX the Sounds from network(directsound) Pin
Mark Salsbery3-May-08 7:38
Mark Salsbery3-May-08 7:38 
GeneralRe: How I can MIX the Sounds from network(directsound) Pin
doudou-shen3-May-08 21:55
doudou-shen3-May-08 21:55 
GeneralRe: How I can MIX the Sounds from network(directsound) Pin
Mark Salsbery4-May-08 6:05
Mark Salsbery4-May-08 6:05 
QuestionQuestion on flexgrid Pin
gReaen3-May-08 4:01
gReaen3-May-08 4:01 
AnswerRe: Question on flexgrid Pin
sunny_vc5-May-08 1:05
sunny_vc5-May-08 1:05 
GeneralRe: Question on flexgrid Pin
gReaen5-May-08 7:21
gReaen5-May-08 7:21 
QuestionProblem with IE7 Pin
H4u323-May-08 3:49
H4u323-May-08 3:49 
AnswerRe: Problem with IE7 Pin
BadJerry11-Sep-09 6:46
BadJerry11-Sep-09 6:46 
QuestionNeed Help with CStdioFile Pin
Larry Mills Sr3-May-08 2:48
Larry Mills Sr3-May-08 2:48 
AnswerRe: Need Help with CStdioFile Pin
Mark Salsbery3-May-08 7:55
Mark Salsbery3-May-08 7:55 
GeneralRe: Need Help with CStdioFile [modified] Pin
Larry Mills Sr4-May-08 3:28
Larry Mills Sr4-May-08 3:28 
GeneralRe: Need Help with CStdioFile Pin
Mark Salsbery4-May-08 6:17
Mark Salsbery4-May-08 6:17 
GeneralRe: Need Help with CStdioFile Pin
Larry Mills Sr4-May-08 9:10
Larry Mills Sr4-May-08 9:10 
GeneralRe: Need Help with CStdioFile Pin
Mark Salsbery4-May-08 11:04
Mark Salsbery4-May-08 11:04 
GeneralRe: Need Help with CStdioFile Pin
Larry Mills Sr5-May-08 2:48
Larry Mills Sr5-May-08 2:48 
Here's my code and the results:

void CSystemDB::FileSaveSys(CString str)
{
CString m_csFileName = ("c:\\Wells\\Program\\DataBases\\Operators\\WSF\\SystemDB.sdb"); //<--set this to an appropriate pathname!!
CStdioFile myFile;
CFileException ex;
if(!myFile.Open(m_csFileName, CFile::modeNoTruncate | CFile::modeCreate | CFile::modeReadWrite | CFile::shareDenyWrite | CFile::typeText, &ex))
{
TCHAR szError[1024];
ex.GetErrorMessage(szError, 1024);
AfxMessageBox(szError, MB_OK, 0);
return;
}
myFile.SeekToEnd(); //<-- do this only if you want to append to an existing file!
myFile.WriteString(_T("A string\r\n"));
myFile.Close();




This is the error I received:
CString m_csFileName = ("c:\\Wells\\Program\\DataBases\\Operators\\WSF\\SystemDB.sdb"); //<--set this to an appropriate pathname!!

error C2440: 'initializing' : cannot convert from 'const char [54]' to 'ATL::CStringT<BaseType,StringTraits>'
1> with
[
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC<wchar_t>
1> ]
1> Constructor for class 'ATL::CStringT<BaseType,StringTraits>' is declared 'explicit'
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC<wchar_t>
1> }

Do you think maybe the switches are set wrong on the compiler? I'm afraid to mess with the compiler settings; but obviously, there is something wrong somewhere.
Mark, I know you are a highly trained programmer, that's obvious from the code of yours I've seen. Something is wrong and I don't know how to fix it.

A C++ programming language novice, but striving to learn

If you want, you can email me directly at: larryamillssr@hughes.net
QuestionRe: Need Help with CStdioFile Pin
David Crow5-May-08 3:00
David Crow5-May-08 3:00 

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.