 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Tom Sapp Guest
|
Posted: Sat Oct 29, 2005 3:50 am Post subject: Visual C++ Open/Save Dialog question |
|
|
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
|
Posted: Sat Oct 29, 2005 3:57 am Post subject: Re: Visual C++ Open/Save Dialog question |
|
|
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
|
Posted: Sat Oct 29, 2005 7:11 am Post subject: Re: Visual C++ Open/Save Dialog question |
|
|
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
|
Posted: Sat Oct 29, 2005 8:34 am Post subject: Re: Visual C++ Open/Save Dialog question |
|
|
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
|
Posted: Sat Oct 29, 2005 9:22 pm Post subject: Re: Visual C++ Open/Save Dialog question |
|
|
"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 |
|
 |
|
|
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
|
|