From filepath string to file object

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

From filepath string to file object

Günther Schmidt
Hi,

I'd like to create a File OBJECT from a string that I get from a
FileOpenDialog.

How would I go about it?


Günther

PS since about 2 days now I am the very proud owner of a DSTPRO license :-D


Reply | Threaded
Open this post in threaded view
|

Re: From filepath string to file object

Schwab,Wilhelm K
Günther

> I'd like to create a File OBJECT from a string that I get from a
> FileOpenDialog.
>
> How would I go about it?

Start browsing on the class side of File.  However, I have found that
FileStream is usually far more useful.  Instances of File, and their
handles, have mostly been of value when doing things to existing files
(changing attributes, etc.) vs. reading/writing them, which is where
streams shine.

What are you trying to do?

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: From filepath string to file object

Günther Schmidt
Hi Bill,

actualy I was merely trying to extract the file name out of the full
path as what I get back from FileOpenDialog is a string and I couldn't
be bothered doing a string operation on it.

I guess you'll think that's overkill?

Thanks

Günther

Bill Schwab schrieb:

> Günther
>
>> I'd like to create a File OBJECT from a string that I get from a
>> FileOpenDialog.
>>
>> How would I go about it?
>
>
> Start browsing on the class side of File.  However, I have found that
> FileStream is usually far more useful.  Instances of File, and their
> handles, have mostly been of value when doing things to existing files
> (changing attributes, etc.) vs. reading/writing them, which is where
> streams shine.
>
> What are you trying to do?
>
> Have a good one,
>
> Bill
>


Reply | Threaded
Open this post in threaded view
|

Re: From filepath string to file object

Yar Hwee Boon-3
On Mon, 27 Dec 2004 03:56:10 +0100, Günther Schmidt <[hidden email]>  
wrote:

> Hi Bill,
>
> actualy I was merely trying to extract the file name out of the full  
> path as what I get back from FileOpenDialog is a string and I couldn't  
> be bothered doing a string operation on it.
>
> I guess you'll think that's overkill?

As suggested by earlier, File is useful when doing things to existing  
files.

--
Regards
HweeBoon
MotionObj


Reply | Threaded
Open this post in threaded view
|

Re: From filepath string to file object

Chris Uppal-3
In reply to this post by Günther Schmidt
Günther Schmidt wrote:

> actualy I was merely trying to extract the file name out of the full
> path as what I get back from FileOpenDialog is a string and I couldn't
> be bothered doing a string operation on it.

There are a bunch of pre-defined methods for doing that kind of thing on the
class-side of File in category 'filename-manipulation'.  E.g:

    File splitFilenameFrom: 'C:\Temp\blabla.dat'.

        --> 'blabla.dat'

HTH

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: From filepath string to file object

Günther Schmidt
Hi Chris,

thanks that's perfect.

Chris Uppal schrieb:

> Günther Schmidt wrote:
>
>
>>actualy I was merely trying to extract the file name out of the full
>>path as what I get back from FileOpenDialog is a string and I couldn't
>>be bothered doing a string operation on it.
>
>
> There are a bunch of pre-defined methods for doing that kind of thing on the
> class-side of File in category 'filename-manipulation'.  E.g:
>
>     File splitFilenameFrom: 'C:\Temp\blabla.dat'.
>
>         --> 'blabla.dat'
>
> HTH
>
>     -- chris
>
>