C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Visual C++ Open/Save Dialog question

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Tom Sapp
Guest





PostPosted: Sat Oct 29, 2005 3:50 am    Post subject: Visual C++ Open/Save Dialog question Reply with quote



I was wondering what the easiest way to get only the filename from the
FileName property of the Save/Open dialogs in Visual C++? I've create a
string variable and set it to SaveDialog1.FileName but that contains
the path and the filename. I know I could go through and find the first
from the end of the variable and remove anything before it but there
has to be an easier, less time consuming way, of doing this. In Delphi
there was a property of the Save/Open dialogs that would automatically
return only the filename and not the path, but, as far as I can tell,
there is not one for Visual C++. Any help and/or ideas would be greatly
appreciated!

Thanks,
Tom Sapp
http://www.sappsworld.com

Back to top
Victor Bazarov
Guest





PostPosted: Sat Oct 29, 2005 3:57 am    Post subject: Re: Visual C++ Open/Save Dialog question Reply with quote



Tom Sapp wrote:
Quote:
I was wondering what the easiest way to get only the filename from the
FileName property of the Save/Open dialogs in Visual C++? [...]

Please ask in 'microsoft.public.vc.language' - the designated Visual
C++ newsgroup. 'comp.lang.c++' talks about standard C++, and it does
not have "Save/Open dialogs", which makes your query off-topic.



Back to top
John Harrison
Guest





PostPosted: Sat Oct 29, 2005 7:11 am    Post subject: Re: Visual C++ Open/Save Dialog question Reply with quote



Tom Sapp wrote:
Quote:
I was wondering what the easiest way to get only the filename from the
FileName property of the Save/Open dialogs in Visual C++? I've create a
string variable and set it to SaveDialog1.FileName but that contains
the path and the filename. I know I could go through and find the first
from the end of the variable and remove anything before it but there
has to be an easier, less time consuming way, of doing this.

Why? Is that really difficult? You sould like one of those programmers
who doesn't actually like programming.

If you wrote a function to do this it would be five lines long (at
most), would take you about 10 minutes, and then you would never have to
write that function again.

John

Back to top
Dave Townsend
Guest





PostPosted: Sat Oct 29, 2005 8:34 am    Post subject: Re: Visual C++ Open/Save Dialog question Reply with quote

Take a look at splitpath and makepath in the MSDN.

"Tom Sapp" <raisor (AT) gmail (DOT) com> wrote

Quote:
I was wondering what the easiest way to get only the filename from the
FileName property of the Save/Open dialogs in Visual C++? I've create a
string variable and set it to SaveDialog1.FileName but that contains
the path and the filename. I know I could go through and find the first
from the end of the variable and remove anything before it but there
has to be an easier, less time consuming way, of doing this. In Delphi
there was a property of the Save/Open dialogs that would automatically
return only the filename and not the path, but, as far as I can tell,
there is not one for Visual C++. Any help and/or ideas would be greatly
appreciated!

Thanks,
Tom Sapp
http://www.sappsworld.com




Back to top
Jim Langston
Guest





PostPosted: Sat Oct 29, 2005 9:22 pm    Post subject: Re: Visual C++ Open/Save Dialog question Reply with quote

"Tom Sapp" <raisor (AT) gmail (DOT) com> wrote

Quote:
I was wondering what the easiest way to get only the filename from the
FileName property of the Save/Open dialogs in Visual C++? I've create a
string variable and set it to SaveDialog1.FileName but that contains
the path and the filename. I know I could go through and find the first
from the end of the variable and remove anything before it but there
has to be an easier, less time consuming way, of doing this. In Delphi
there was a property of the Save/Open dialogs that would automatically
return only the filename and not the path, but, as far as I can tell,
there is not one for Visual C++. Any help and/or ideas would be greatly
appreciated!

Thanks,
Tom Sapp
http://www.sappsworld.com


What's so hard about that? If it's a std::string just use
find_last_of(...). If it's not a std::string, make it one.

std::string FullPath = CStringReturnedFromUglyWindowsCode;



Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.