Click here to Skip to main content
15,917,997 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCFile %&% Pin
macmac386-May-03 2:50
macmac386-May-03 2:50 
GeneralRe: CFile %&% Pin
Mike Zinni6-May-03 3:15
Mike Zinni6-May-03 3:15 
You might want to try:

CFileDialog dlg(FALSE);
CString fname = dlg.GetPathName(); 
const char* szBuffer = fname.GetBuffer(0);
int i = fname.GetLength();

CFile f;
// CFile::modeWrite is OK if you want to append
// data to the end of the file. If you're looking
// to create a new file and have it contain JUST this
// filename, you need to open the CFile with the 
// CFile::modeCreate flag.
if( f.Open ("F:\\test\\id.txt", CFile::modeWrite ) )
{
  try{
    f.Write(szBuffer, i);
    f.Close();
  } catch (CFileException *e)
  {
    AfxMessageBox ("Error!");
    e->Delete();
  }
}
// And remember to release your string pointer.
fname.ReleaseBuffer();


-Mike Zinni

"No sh*t it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job."
GeneralRe: CFile %&% Pin
macmac386-May-03 3:24
macmac386-May-03 3:24 
GeneralRe: CFile %&% Pin
macmac386-May-03 3:54
macmac386-May-03 3:54 
GeneralRe: CFile %&% Pin
Mike Zinni6-May-03 4:10
Mike Zinni6-May-03 4:10 
GeneralRe: CFile %&% Pin
macmac386-May-03 4:45
macmac386-May-03 4:45 
GeneralRe: CFile %&% Pin
David Crow6-May-03 4:49
David Crow6-May-03 4:49 
GeneralRe: CFile %&% Pin
macmac387-May-03 3:56
macmac387-May-03 3:56 
GeneralRe: CFile %&% Pin
David Crow6-May-03 4:20
David Crow6-May-03 4:20 
GeneralRe: CFile %&% Pin
Hans Ruck6-May-03 3:18
Hans Ruck6-May-03 3:18 
Generalstring substitution Pin
JensB6-May-03 2:49
JensB6-May-03 2:49 
GeneralRe: string substitution Pin
G. Steudtel6-May-03 4:02
G. Steudtel6-May-03 4:02 
QuestionHow to create a Virtual Serial Port with C++? Pin
d.schaeflein6-May-03 2:47
d.schaeflein6-May-03 2:47 
GeneralConvert "unsigned char[8]" to long Pin
Abebe6-May-03 2:42
Abebe6-May-03 2:42 
GeneralRe: Convert "unsigned char[8]" to long Pin
Xander806-May-03 2:52
Xander806-May-03 2:52 
GeneralRe: Convert "unsigned char[8]" to long Pin
Abebe8-May-03 4:55
Abebe8-May-03 4:55 
Generalshow web Page in a dialog box.. Pin
xxhimanshu6-May-03 2:39
xxhimanshu6-May-03 2:39 
GeneralRe: show web Page in a dialog box.. Pin
Joan M6-May-03 3:30
professionalJoan M6-May-03 3:30 
GeneralRe: show web Page in a dialog box.. Pin
Majid Shahabfar6-May-03 4:29
Majid Shahabfar6-May-03 4:29 
GeneralExtra Buttons on a SDI-Dialog Frame Pin
Harald Diel6-May-03 1:04
Harald Diel6-May-03 1:04 
GeneralRe: Extra Buttons on a SDI-Dialog Frame Pin
Neville Franks6-May-03 1:28
Neville Franks6-May-03 1:28 
GeneralRe: Extra Buttons on a SDI-Dialog Frame Pin
Roger Allen6-May-03 2:24
Roger Allen6-May-03 2:24 
Generalan easy unzip example Pin
includeh105-May-03 23:49
includeh105-May-03 23:49 
Questionchanging dialog of a dialog-based application at rutime with another dll's dialog? Pin
vcseeker5-May-03 21:21
vcseeker5-May-03 21:21 
AnswerRe: changing dialog of a dialog-based application at rutime with another dll's dialog? Pin
John R. Shaw6-May-03 7:20
John R. Shaw6-May-03 7:20 

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.