iOS Question Read a txt file

Discussion in 'iOS Questions' started by Giusy, Aug 11, 2018.

  1. Giusy

    Giusy Active Member Licensed User

    Hi, in B4A I read my txt file so:

    Code:
    Private tr As TextReader
    tr.Initialize(
    File.OpenInput(File.DirAssets, "myfile.txt"))

    strLines = tr.ReadLine

    FOR SS=1 TO 7
    strLines = tr.ReadLine
    ....
    ....
    NEXT SS
    tr.Close
    [code]

    Now 
    in B4I how should i do?
     
  2. Filippo

    Filippo Expert Licensed User

    Very easily:
    Code:
    Dim txt As String = File.ReadString(File.DirAssets, "myfile.txt")
     
    Giusy likes this.
  3. Giusy

    Giusy Active Member Licensed User

    Scusa @Filippo ma come movimento la lettura dei sette record?
    but as a movement the reading of the seven records?
     
  4. Filippo

    Filippo Expert Licensed User

    Code:
    Dim txt As String = File.ReadString(File.DirAssets, "myfile.txt")
    Dim str() as string = regex(crlf, txt)
     
    Giusy likes this.
  5. Erel

    Erel Administrator Staff Member Licensed User

    Never use TextWriter or TextReader unless you need to read a non UTF8 encoded file.

    Code:
    Dim lines As List = File.ReadList(...)
     
    Giusy likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice