mIRC Home    About    Download    Register    News    Help

Print Thread
#47472 05/09/03 06:58 PM
Joined: Sep 2003
Posts: 156
B
bleach Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Sep 2003
Posts: 156
How do I read a text file and write that what I read to another file?

#47473 05/09/03 07:01 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
write file2 $read(file1)


new username: tidy_trax
#47474 05/09/03 07:06 PM
Joined: Dec 2002
Posts: 124
B
Vogon poet
Offline
Vogon poet
B
Joined: Dec 2002
Posts: 124
the help file explain $read very well

#47475 05/09/03 07:14 PM
Joined: Sep 2003
Posts: 156
B
bleach Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Sep 2003
Posts: 156
that doesnt write properly if mirc codes are available on reading file.. for example:
Code:
  
alias readwrite {
   var %i = 1
    while (%i <= $lines(test.txt) {
     write example.txt $read($mircdirtest.txt,%i)
    inc %i
  }
}

#47476 05/09/03 07:57 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
alias readwrite {   
  var %i = 1    
  while (%i <= $lines(test.txt)[color:red])[/color] {     
    write example.txt $read($mircdirtest.txt,%i)   
    inc %i  
  }
}


Test1.txt contains:
T
Te
Tes
Test
Testi
Testin
Testing

Test2.txt was created and now contains:

T
Te
Tes
Test
Testi
Testin
Testing

#47477 05/09/03 08:09 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
$mircdirtest.txt is not needed, just test.txt will do....


new username: tidy_trax
#47478 05/09/03 08:24 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I was modifying Bleach's post, I didn't want to change his code, just correct his little error.

#47479 06/09/03 08:06 AM
Joined: Sep 2003
Posts: 156
B
bleach Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Sep 2003
Posts: 156
man that code doesnt write...

#47480 06/09/03 11:39 AM
Joined: Feb 2003
Posts: 10
Z
Pikka bird
Offline
Pikka bird
Z
Joined: Feb 2003
Posts: 10
Quote:

that doesnt write properly if mirc codes are available on reading file.. for example:


..if i understood you right the problem might be that your file contains source code and will be evaluated during $read /write process.. ..try the -n switch with $read, should work fine if that s your problem,, like:
Code:
...
write example.txt $read($mircdirtest.txt,n,%i)
...



return is the movement of sense.
#47481 06/09/03 12:25 PM
Joined: Aug 2003
Posts: 73
C
Babel fish
Offline
Babel fish
C
Joined: Aug 2003
Posts: 73
you may need this for a purpose besides this, but maybe you should use
/copy "filename 1" "new filename"
!!!grin!!!


The blue monkey is out of its barrel...
#47482 06/09/03 04:26 PM
Joined: Sep 2003
Posts: 2
S
Bowl of petunias
Offline
Bowl of petunias
S
Joined: Sep 2003
Posts: 2
heheh good one smile.

ya just use /copy ...


w00t
#47483 06/09/03 06:02 PM
Joined: Sep 2003
Posts: 156
B
bleach Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Sep 2003
Posts: 156
z00ey thanks =)


Link Copied to Clipboard