Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Dec 18, 2018 11:46 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Open Text File For Input
PostPosted: Wed Feb 06, 2013 8:49 am 
Offline

Joined: Mon Jan 21, 2013 6:05 pm
Posts: 18
I want to open a text file for input.
I want to avoid the open dialogue, because I know the filenamde.
How do I do this?


Top
 Profile  
Reply with quote  
 Post subject: Re: Open Text File For Input
PostPosted: Wed Feb 06, 2013 9:11 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
First off read the documentation

dim f as folderitem
dim t as textinputstream
dim s as string
f=speccialfolder.desktop.child("mydata.txt") ' change this line to point to where your file really is
t=textinputstream.open(f)
s=t.readall ' this string now holds the entire contents of your file [see also t.read and t.readline
t.close

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Open Text File For Input
PostPosted: Fri Feb 08, 2013 1:45 pm 
Offline

Joined: Mon Jan 21, 2013 6:05 pm
Posts: 18
Thanks, but what the heck is "f=speccialfolder.desktop.child...etc.?


Top
 Profile  
Reply with quote  
 Post subject: Re: Open Text File For Input
PostPosted: Fri Feb 08, 2013 1:58 pm 
Offline
User avatar

Joined: Mon Feb 05, 2007 5:21 pm
Posts: 600
Location: New York, NY
Look at the "SpecialFolder" entry in the Language Reference.

_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.


Top
 Profile  
Reply with quote  
 Post subject: Re: Open Text File For Input
PostPosted: Fri Feb 08, 2013 2:05 pm 
Offline

Joined: Mon Jan 21, 2013 6:05 pm
Posts: 18
Thanks ktekinay.
The file I am going to open is in the application directory.
Is there a RB equivalent to Visual Studio's "app.path"?


Top
 Profile  
Reply with quote  
 Post subject: Re: Open Text File For Input
PostPosted: Fri Feb 08, 2013 2:19 pm 
Offline

Joined: Mon May 30, 2011 12:56 am
Posts: 702
Quote:
Is there a RB equivalent to Visual Studio's "app.path"?


Dim AppPath as folderitem
AppPath = getfolderitem("")


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group