Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Reading in a file's contents

PoormanPoorman Member Posts: 13
Hello everyone, I a still a newbie when it comes to VB and would appreciate your help. A program I am working on reads in the contents of a text file line by line. Example, it take the first line of the text file, reads it in and breaks up the information to be put into different variables. Reads in the next line and does the same. The lines are all of different lengths and contain both integers and characters. The numbers and characters are separated by a comma inwhich the comma marks the end of the data to be put in one variable. My question is, is there a read statment that will read until the end of line (EOL?)? And how would I take the information between commas and put them into a variable? I have googled both questions and come up with nothing. I would like to hear from someone that could point me in the right direction. Thank you for you time,

Poorman

Comments

  • lionblionb Member Posts: 1,688 ✭✭
    I have googled both questions and come up with nothing. I would like to hear from someone that could point me in the right direction. Thank you for you time,
    :
    : Poorman
    :
    Ther are two more places where we'll find some help. VB Book (you can find it in library) and MSDN on line
    Try this
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vastmlineinputx.asp
  • AsifAliAsifAli Member Posts: 39
    : Hello everyone, I a still a newbie when it comes to VB and would appreciate your help. A program I am working on reads in the contents of a text file line by line. Example, it take the first line of the text file, reads it in and breaks up the information to be put into different variables. Reads in the next line and does the same. The lines are all of different lengths and contain both integers and characters. The numbers and characters are separated by a comma inwhich the comma marks the end of the data to be put in one variable. My question is, is there a read statment that will read until the end of line (EOL?)? And how would I take the information between commas and put them into a variable? I have googled both questions and come up with nothing. I would like to hear from someone that could point me in the right direction. Thank you for you time,
    :
    : Poorman
    :


    see

    filename=anything
    open filename for input as #1
    while not eof(1)
    line input #1, rec$
    Values=split(rec$,",")
    for ic=0 to ubound(Values)
    print Values(ic)
    next
    wend
    close(1)
  • AsifAliAsifAli Member Posts: 39
    : Hello everyone, I a still a newbie when it comes to VB and would appreciate your help. A program I am working on reads in the contents of a text file line by line. Example, it take the first line of the text file, reads it in and breaks up the information to be put into different variables. Reads in the next line and does the same. The lines are all of different lengths and contain both integers and characters. The numbers and characters are separated by a comma inwhich the comma marks the end of the data to be put in one variable. My question is, is there a read statment that will read until the end of line (EOL?)? And how would I take the information between commas and put them into a variable? I have googled both questions and come up with nothing. I would like to hear from someone that could point me in the right direction. Thank you for you time,
    :
    : Poorman
    :


    see

    filename=anything
    open filename for input as #1
    while not eof(1)
    line input #1, rec$
    Values=split(rec$,",")
    for ic=0 to ubound(Values)
    print Values(ic)
    next
    wend
    close(1)
  • Justin BibJustin Bib USAMember Posts: 0

    ______ [ http://forcoder.org ] free ebooks and video tutorials about < Scratch, C, Java, Swift, Objective-C, Visual Basic .NET, PHP, Go, R, MATLAB, JavaScript, Ruby, Delphi, Visual Basic, C#, Assembly, C++, PL/SQL, Perl, Python Lua, COBOL, FoxPro, Kotlin, Alice, Scheme, Clojure, SAS, Transact-SQL, Bash, LabVIEW, Awk, F#, Apex, Julia, Dart, Lisp, Prolog, ML, Logo, Ada, VBScript, Rust, ABAP, Crystal, Scala, Fortran, D, Hack, Erlang /> __

Sign In or Register to comment.