Sign in to follow this  
Followers 0
gaiaplay

File Reading Help

4 posts in this topic

#1 ·  Posted (edited)

Thanks,

Gaiaplay

Edited by gaiaplay

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Did you see the Fileread functions in the help file?

Heres Some sample code to you started.

$Handle=FileOpen(".\Dummy.txt",0)
While 1
    $Line=FileReadLine($Handle)
    If @Error=-1 then ExitLoop
    $Array=StringSplit($Line,":")
    $C1=$Array[1]
    $C3=$Array[3]
    MsgBox(0,"Column 1",$C1)
    MsgBox(0,"Column 3",$C3)
WEnd

Edit:Added Code

Edited by P5ych0Gigabyte

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

This will do it

Global $OriginalFile = "c:\files\dummy.txt"
Global $NewFile = "c:\files\dummy2.txt"
Doit()
Func Doit()
    $hIn = FileOpen($OriginalFile ,0)
    $hOut = FileOpen($NewFile,1)

    While True
        $sline = FileReadLine($hIn)
        If @error Then ExitLoop
        $vSplit = StringSplit($sLine,':')
        If UBound($vSplit) > 3 Then FileWriteLine($hOut,$vSplit[1] & ':' & $vSplit[3] )
    WEnd

    FileClose($hIn)
    FileClose($hOut)
EndFunc

Share this post


Link to post
Share on other sites

TY guys you are great. I now have an idea how to handle this one. THANKS once again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0