Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Visual C++ Open/Save Dialog question

Reply
Thread Tools

Visual C++ Open/Save Dialog question

 
 
Tom Sapp
Guest
Posts: n/a
 
      10-29-2005
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

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      10-29-2005
Tom Sapp wrote:
> 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.


 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      10-29-2005
Tom Sapp wrote:
> 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
 
Reply With Quote
 
Dave Townsend
Guest
Posts: n/a
 
      10-29-2005
Take a look at splitpath and makepath in the MSDN.

"Tom Sapp" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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
>



 
Reply With Quote
 
Jim Langston
Guest
Posts: n/a
 
      10-29-2005
"Tom Sapp" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>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;


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i add dialog boxes in visual c++ chatsash C++ 0 06-05-2007 05:16 PM
How to hide the dialog when execute a dialog based application in VC? yw C++ 3 07-02-2005 03:35 AM
Linking Menu bar to dialog box using Visual C++ 6.0 Ritesh C++ 1 04-25-2005 06:48 PM
display print preview dialog, not print dialog Matt Javascript 1 11-20-2004 01:18 AM
Re: visual c++ 6 / newbie: hide ODBC connect dialog John Harrison C++ 5 10-21-2003 04:30 PM



Advertisments