Results 1 to 5 of 5

Thread: RD single chars in txt files (VB6)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    23

    Unhappy

    What is the string/s for reading a single char as a variable,then reading the next char after that as a vairable, then reading the next char after that as a variable etc. In a text file?
    Thankyou

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    String*1 is a fixed length string with length 1 but as you want to read a file i think you should use a byte array instead:
    Dim chas as byte

    To read a file use:

    ff=freefile
    Open file for binary as ff
    Get#ff,,char
    close ff
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    23

    Rd single char

    Thanks for that I really appreciate it, but how would you rd the next char of that line in the txtfile(same code?). Also how do you skip a line in a txt file.

    Thanks Again!

  4. #4

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    23

    Rd single char

    Thanks for that I really appreciate it, but how would you rd the next char after the 1st read char of that line in the txtfile(same code?). Also how do you skip a line in a txt file.

    Thanks Again!

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well in binary access mode you can't read lines so i think you have to jump over to input (for text files only)
    Lineinput #ff,Line
    To get the next char in input it's a bit harder, you need to split the strings you get and you can't know if it is carriage or clear linefeed that you get. Use Binary in this case:
    char=space(1)
    Get #ff,char
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width