Click here to Skip to main content
15,887,676 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
I discovered the error(except for the errors you mentioned. "m_csFileName" is also a CString and CStdioFile requires a TCHAR evidently. When I changed it to TCHAR it wrote the file! Is there a way to copy a CString into a TCHAR? I really need to do that, because I build the path the User has chosen from a lot of Editboxes which I get using a CString; hence my need to be able to copy the gathered data in the CString into a TCHAR. Do you know how to do that?

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

I made the changes you suggesed and I hardcoded the path and it created the file but it didn't write anything into the file even though "str" was loaded here:
void CSystemDB::FileSaveSys(CString str)
{
m_csFileName.Format(ID_CONVERTTOTCHAR,str);
// open a file
CStdioFile myFile;
CFileException ex;
if(!myFile.Open(pszFileName, CFile::modeNoTruncate | CFile::modeCreate | CFile::typeText, &ex))
{
TCHAR szError[1024];
ex.GetErrorMessage(szError, 1024);
AfxMessageBox(szError, MB_OK, 0);
return;
}
ULONGLONG len = myFile.GetLength();
DWORD dw = GetLastError();// error_path_not_found (3)
if(dw == 0 || dw == 183)
{
// File exists so setup to add to it with this batch:
//myFile.Seek( len +1, CFile::begin );
}

for(m_vSys.m_ITFileStr = m_vSys.m_vFileStr.begin() ; m_vSys.m_ITFileStr != vSys.m_vFileStr.end(); m_vSys.m_ITFileStr++)
{
// First get CSysData from vector:
str = *m_vSys.m_ITFileStr;

myFile.WriteString(str);// was loaded in Debug
}
myFile.Close();
the error returned is "Disk Full" yet nothing is written in the file! and I have over 65 GB of disk space. What gives?

<div class="ForumMod">modified on Sunday, May 4, 2008 10:12 AM</div>
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 
QuestionRe: Need Help with CStdioFile Pin
David Crow5-May-08 3:00
David Crow5-May-08 3:00 
AnswerRe: Need Help with CStdioFile Pin
Larry Mills Sr5-May-08 4:57
Larry Mills Sr5-May-08 4:57 
GeneralRe: Need Help with CStdioFile Pin
David Crow5-May-08 5:25
David Crow5-May-08 5:25 
GeneralRe: Need Help with CStdioFile Pin
Mark Salsbery5-May-08 5:55
Mark Salsbery5-May-08 5:55 
GeneralRe: Need Help with CStdioFile Pin
Mark Salsbery5-May-08 6:05
Mark Salsbery5-May-08 6:05 
GeneralRe: Need Help with CStdioFile Pin
Mark Salsbery5-May-08 4:59
Mark Salsbery5-May-08 4:59 
GeneralRe: Need Help with CStdioFile Pin
Larry Mills Sr5-May-08 6:42
Larry Mills Sr5-May-08 6:42 
GeneralRe: Need Help with CStdioFile Pin
Mark Salsbery5-May-08 6:47
Mark Salsbery5-May-08 6:47 
GeneralRe: Need Help with CStdioFile Pin
Larry Mills Sr5-May-08 7:11
Larry Mills Sr5-May-08 7:11 
GeneralRe: Need Help with CStdioFile Pin
Larry Mills Sr6-May-08 5:42
Larry Mills Sr6-May-08 5:42 
GeneralRe: Need Help with CStdioFile Pin
Mark Salsbery7-May-08 6:33
Mark Salsbery7-May-08 6:33 
GeneralRe: Need Help with CStdioFile Pin
Larry Mills Sr8-May-08 8:03
Larry Mills Sr8-May-08 8:03 
GeneralRe: Need Help with CStdioFile Pin
Larry Mills Sr11-May-08 16:22
Larry Mills Sr11-May-08 16:22 

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.