Jump to content

fileread few char


Recommended Posts

hello

This code will read file and show all in text file

if i need to show only few characters in file then wat to do like

text file have my name ASIM

ASIM TYPE 70 times in text file now how to show all list of Asim in MsgBox()

$file = FileOpen("test.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

    MsgBox(0, "Error", "Unable to open file.")

    Exit

EndIf

; Read in 1 character at a time until the EOF is reached

While 1

    $chars = FileRead($file, 999999)

    If @error = -1 Then ExitLoop

    MsgBox(0, "Char read:", $chars)

Wend

FileClose($file)

i hope u get my point

Link to comment
Share on other sites

not sure exactly what you want... but maybe this

dim $cnt="", $Count="70" ; put any number you want here

$file = FileOpen("test.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in 1 character at a time until the EOF is reached

While 1

$chars = FileRead($file, 999999)

If @error = -1 Then ExitLoop

MsgBox(0, "Char read:", $chars)

$cnt= $cnt +1

If $cnt>= $Count then

$Chars="ASIM"

$Cnt=""

MsgBox(0, "Char read:", $chars)

Endif

Wend

FileClose($file)

mabe it helps

8)

NEWHeader1.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...