mIRC Homepage

how do I .....

Posted By: bleach

how do I ..... - 05/09/03 06:58 PM

How do I read a text file and write that what I read to another file?
Posted By: pheonix

Re: how do I ..... - 05/09/03 07:01 PM

write file2 $read(file1)
Posted By: bloupx

Re: how do I ..... - 05/09/03 07:06 PM

the help file explain $read very well
Posted By: bleach

Re: how do I ..... - 05/09/03 07:14 PM

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
  }
}
Posted By: SladeKraven

Re: how do I ..... - 05/09/03 07:57 PM

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
Posted By: pheonix

Re: how do I ..... - 05/09/03 08:09 PM

$mircdirtest.txt is not needed, just test.txt will do....
Posted By: SladeKraven

Re: how do I ..... - 05/09/03 08:24 PM

I was modifying Bleach's post, I didn't want to change his code, just correct his little error.
Posted By: bleach

Re: how do I ..... - 06/09/03 08:06 AM

man that code doesnt write...
Posted By: z00ey

Re: how do I ..... - 06/09/03 11:39 AM

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)
...

Posted By: CyBot

Re: how do I ..... - 06/09/03 12:25 PM

you may need this for a purpose besides this, but maybe you should use
/copy "filename 1" "new filename"
!!!grin!!!
Posted By: shagr4th

Re: how do I ..... - 06/09/03 04:26 PM

heheh good one smile.

ya just use /copy ...
Posted By: bleach

Re: how do I ..... - 06/09/03 06:02 PM

z00ey thanks =)
© 2021 mIRC Discussion Forums