It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Read Write an asci

Moderator: dafunkymunky

Read Write an asci

Postby remi on Tue Nov 18, 2008 10:10 am

Hi everybody

is there anybody out there who cant help me reading a text, 4 exp:
0000 0000
1111 11111
2222 22222
3333 33333
4444 44444

5555 55555
6666 66666
7777 77777
8888 88888
9999 99999

aaaa aaaa
bbbb bbbb
cccc cccc
dddd dddd
eeee eeee


and writing to a file, each 1 , 3,5 and 7 line input in this case:

2222 2222
3333 3333
7777 7777
8888 8888
cccc cccc
dddd dddd

thanks
remi
 
Posts: 0
Joined: Tue Nov 18, 2008 9:56 am

Postby panzer on Wed Nov 19, 2008 12:10 am

I've done a bit with Visual Basic 6, but I don't quite understand what you're asking.

I *think* you're hinting at reading the above into an array and then writing it back out. I can try a give a basic VB6 example, but I don't know about other variations.

Code: Select all
dim arr() as string ' container for file data
dim idx as integer
idx = 0

redim arr(15) as string

open filename for input as #1
do while not eof(1)
line input #1, arr(idx);
idx = idx + 1
loop

close #1
' do something with arr
erase arr


If you need to write back specific lines, then just loop through the array and write out the desired index. If that isn't what you need, then sorry... perhaps someone else can help out. :)
panzer
 
Posts: 7
Joined: Mon Nov 17, 2008 5:50 am


Who is online

Users browsing this forum: No registered users and 4 guests