Skip to main content
gamedev.net
🔒 Locked

MFC application`s pathname?

Started by Basiror 1 reply 500+ views
Original Post
Basiror
Basiror
i am working on the loading code for my application and i have one problem when you use the CFileDialog class to get the pathname of a file
char sz[256];
	char szFilter[] = "Text files (*.txt)|*.txt|Bitmap Files (*.bmp)|*.bmp|Data Files (*.dat;*.dta)|*.dat; *.dta|All Files (*.*)|*.*||";
	CFileDialog dlg(TRUE,_T("All files (*.*)"),_T("*.*"),OFN_FILEMUSTEXIST|OFN_HIDEREADONLY,szFilter);
	
	if(dlg.DoModal()==IDOK)
	{
		
		FILE *f=NULL;
	f=fopen("pathname.txt","wt");
	
	if(!feof(f))
	{
		CString a;
		a=dlg.GetPathName();
	
		sprintf(sz,"%s \n",a.GetBuffer(50));
		fputs(sz,f);
		fclose(f);
	}
	}
[/CODE]

and write a txt file with the path in it it saves the file to the directory where the file which i have opened with the file dialog is in

i want to save the file into the same directory as the application`s .exe 


any idea how that works?    
http://www.8ung.at/basiror/theironcross.html
Basiror
Basiror
thx a lot
this function works fine
http://www.8ung.at/basiror/theironcross.html

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.