fileObj.Open
-
hi all vc++ masters 1)i use this code on a button CString strpath="C:\\72456\\gg.txt"; CStdioFile fileObj; fileObj.Open(strpath, CFile::modeRead | CFile::shareDenyWrite); but it could not open the gg file please help me 2)i want that when i write a name of file on edit box and click on button it search file in c drive and open it thanks
-
hi all vc++ masters 1)i use this code on a button CString strpath="C:\\72456\\gg.txt"; CStdioFile fileObj; fileObj.Open(strpath, CFile::modeRead | CFile::shareDenyWrite); but it could not open the gg file please help me 2)i want that when i write a name of file on edit box and click on button it search file in c drive and open it thanks
-
do you actually want to open the file to write or read something? or are you looking to open the file in notepad automatically.
-
hi all vc++ masters 1)i use this code on a button CString strpath="C:\\72456\\gg.txt"; CStdioFile fileObj; fileObj.Open(strpath, CFile::modeRead | CFile::shareDenyWrite); but it could not open the gg file please help me 2)i want that when i write a name of file on edit box and click on button it search file in c drive and open it thanks
For second section of your question see
CFileFind
Class . and for first section are you sure you have this file on the correct path? -
hi all vc++ masters 1)i use this code on a button CString strpath="C:\\72456\\gg.txt"; CStdioFile fileObj; fileObj.Open(strpath, CFile::modeRead | CFile::shareDenyWrite); but it could not open the gg file please help me 2)i want that when i write a name of file on edit box and click on button it search file in c drive and open it thanks
p_ wrote:
but it could not open the gg file
Why not? Are you for sure that the file exists? Have you tried to pass a
CFileException*
when callingOpen()
method?p_ wrote:
2)i want that when i write a name of file on edit box and click on button it search file in c drive and open it
If the edit control also contains the file's path, no searching is required. Just use
CFile
orCStdioFile
to open the file.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
to write data into file,use FILE * fp; fp=fopen("filename.txt","w"); fprintf("hello"); fclose(fp); to open the file automatically, use system("notepad filename.txt");
chandu004 wrote:
FILE * fp; fp=fopen("filename.txt","w"); fprintf("hello"); fclose(fp); to open the file automatically, use system("notepad filename.txt");
:confused::rolleyes::omg::wtf:
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
chandu004 wrote:
FILE * fp; fp=fopen("filename.txt","w"); fprintf("hello"); fclose(fp); to open the file automatically, use system("notepad filename.txt");
:confused::rolleyes::omg::wtf:
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
:sigh:
Mark Salsbery Microsoft MVP - Visual C++ :java: