Fixed Lenght Text Files

Does anybody have any hints, tips, comments etc for

opening, processing and writeing fixed length text files

in VB5


Comments

  • : Does anybody have any hints, tips, comments etc for

    : opening, processing and writeing fixed length text files

    : in VB5


    Well I don't know what you want to do but here is

    some information:


    'Get the next availiable file number

    next_free_file_number = FreeFile



    'open the text file in input mode.

    Open "file.txt" For Input As next_free_file_number



    'while your not at the end of the file loop

    While Not EOF(next_free_file_number)



    'Do proccessing in this loop



    'read in a value from the text file



    'this syntax is mainly for a text file written with the write command

    'because it reads in from " "

    Input #next_free_file_number, some_variable



    'This syntax will read in a whole line from the file until it hits a

    'new line character i think.

    Line Input #next_free_file_number, some_variable



    'You can also use this syntax to read a certain number of character

    'at a time into a variable

    some_variable = Input(Number_of_character_to_read, #next_free_file_number)



    Wend



    'close the file when you are done.

    Close (next_free_file_number)


    Here are some common function to look into, they are for handling strings.


    Compare two strings. StrComp

    Convert strings. StrConv

    Convert to lowercase or uppercase. Format, LCase, UCase

    Create string of repeating character. Space, String

    Find length of a string. Len

    Format a string. Format

    Justify a string. LSet, RSet

    Manipulate strings. InStr, Left, LTrim, Mid, Right, RTrim, Trim

    Set string comparison rules. Option Compare

    Work with ASCII and ANSI values. Asc, Chr


    I hope this isn't to basic for you. If there is something more specific that you are trying

    to do feel free to e-mail me.


    Good Luck,

    Paul Sprague


Sign In or Register to comment.

Howdy, Stranger!

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

Categories