Jump to content
Sign in to follow this  
gaiaplay

File Reading Help

Recommended Posts

gaiaplay

Thanks,

Gaiaplay

Edited by gaiaplay

Share this post


Link to post
Share on other sites
FuryCell

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
Quual

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
gaiaplay

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.