File writeing [modified]
-
Hi All, I want to write the contents of the edit box to file i have used this code but its not working can u tell me the cause.. i want to remove the old contetns and add the contetns of the edit box. str holds the file name. CStdioFile file(str, CFile::modeWrite); file.Open(str); char *pBuffer = new char[dwSize + 1]; m_FCONT.GetWindowText(*pBuffer); UINT uWrite = file.Write(pBuffer, dwSize); delete [] pBuffer; Regards, Vinay Charan.
-
Hi All, I want to write the contents of the edit box to file i have used this code but its not working can u tell me the cause.. i want to remove the old contetns and add the contetns of the edit box. str holds the file name. CStdioFile file(str, CFile::modeWrite); file.Open(str); char *pBuffer = new char[dwSize + 1]; m_FCONT.GetWindowText(*pBuffer); UINT uWrite = file.Write(pBuffer, dwSize); delete [] pBuffer; Regards, Vinay Charan.
you can use (CArchive /CFile)for your work_**
**_
whitesky
-
you can use (CArchive /CFile)for your work_**
**_
whitesky
-
Hi whitesky, I have used CFile but i am nt getting how to save in the file can u plz c the code. Regards, Vinay Charan.
-
Hi whitesky, I have used CFile but i am nt getting how to save in the file can u plz c the code. Regards, Vinay Charan.
and one simple example
CFile m_File("c:\\text2.txt",CFile::modeCreate|CFile::modeWrite); TCHAR buf[120]; m_Edit1.GetWindowText(buf,sizeof(buf)); m_File.Write(buf, lstrlen(buf)); m_File.Close();
_**
**_
whitesky
-
Hi All, I want to write the contents of the edit box to file i have used this code but its not working can u tell me the cause.. i want to remove the old contetns and add the contetns of the edit box. str holds the file name. CStdioFile file(str, CFile::modeWrite); file.Open(str); char *pBuffer = new char[dwSize + 1]; m_FCONT.GetWindowText(*pBuffer); UINT uWrite = file.Write(pBuffer, dwSize); delete [] pBuffer; Regards, Vinay Charan.
In Continuation with WhiteSky, better option will CStdioFile, which deal will Text based File
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
-
Hi All, I want to write the contents of the edit box to file i have used this code but its not working can u tell me the cause.. i want to remove the old contetns and add the contetns of the edit box. str holds the file name. CStdioFile file(str, CFile::modeWrite); file.Open(str); char *pBuffer = new char[dwSize + 1]; m_FCONT.GetWindowText(*pBuffer); UINT uWrite = file.Write(pBuffer, dwSize); delete [] pBuffer; Regards, Vinay Charan.
VinayCool wrote:
...but its not working
What is not working? Be specific.
VinayCool wrote:
file.Open(str);
It is not necessary to call the
Open()
method. The constructor has already done this.
"The largest fire starts but with the smallest spark." - David Crow
-
Hi All, I want to write the contents of the edit box to file i have used this code but its not working can u tell me the cause.. i want to remove the old contetns and add the contetns of the edit box. str holds the file name. CStdioFile file(str, CFile::modeWrite); file.Open(str); char *pBuffer = new char[dwSize + 1]; m_FCONT.GetWindowText(*pBuffer); UINT uWrite = file.Write(pBuffer, dwSize); delete [] pBuffer; Regards, Vinay Charan.