New topic: 

open a text file

<http://forums.realsoftware.com/viewtopic.php?t=32259>

       Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic         Author  
Message       cameronasmith           Post subject: open a text filePosted: Sat 
Jan 30, 2010 12:16 am                        
Joined: Wed Jan 06, 2010 3:44 pm
Posts: 11              Hi,

I am trying to open a file on my mac with RB this is the code:

  Dim f As FolderItem
  Dim textInput As TextInputStream
  Dim rowFromFile,oneCell As String
  Dim i As Integer
  f=GetOpenfolderItem("database.txt") //defined as a FileType
  If f <> Nil Then
  textInput =TextInputStream.Open(f)
  textInput.Encoding=Encodings.MacRoman //strings are MacRoman
  Do
  rowFromFile=textInput.ReadLine
  If ListBox1.ColumnCount < CountFields(rowFromFile,Chr(9)) Then
    ListBox1.ColumnCount=CountFields(rowFromFile,Chr(9))
  End If
  ListBox1.AddRow NthField(rowFromFile,Chr(9),1)
  For i=1 to CountFields(rowFromFile,Chr(9))
    oneCell=NthField(rowFromFile,Chr(9),i)
    ListBox1.Cell(ListBox1.ListCount-1,i-1)=oneCell
  Next
  Loop Until textInput.EOF
  textInput.Close
  End If

All the files are disabled i cannot click on any of them i can only click on 
the folders. Please help

Thanks,

Cameron   
                            Top                IIGS_User           Post 
subject: Re: open a text filePosted: Sat Jan 30, 2010 1:55 am                   
            
Joined: Tue Oct 24, 2006 3:38 am
Posts: 55              Code:file=GetOpenFolderItem(FileTypes.ApplicationText)
While ApplicationText is the objectname in filetypes.     
_________________
I don't want plug-ins, still on REALbasic 2009r5 on a PowerPC-based Mac with 
Mac OS X 10.4.11.  
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to