To replace all X's in input.txt with Y's in output.txt, you can do:

'input.txt' asFileReference readStreamDo: [ :in |
  'output.txt' asFileReference writeStreamDo: [ :out |
    [ in atEnd ] whileFalse: [
       | ch |
       (ch := in read) = $X
         ifTrue: [ out nextPut: $Y ]
         ifFalse: [ out nextPut: ch ] ] ] ].

> On 16 May 2015, at 18:56, valmy roi <roykenva...@gmail.com> wrote:
> 
> that is my problem, replacing the character with another one, how can i do it?
> 
> 2015-05-16 11:28 UTC+01:00, Sergio Fedi <sergio.f...@gmail.com>:
>> Maybe you should open a stream reading the original file
>> the open a writing stream for the copy file
>> And reading from one, writing on the other, replacing what you need in the
>> intermediate collection of bytes/characters
>> ​
>> 
> 
> 
> -- 
> Kenfack Valmy-Roi
> Ingénieur des travaux en Informatique de Gestion/ Analyste Programmeur
> Elève ingénieur de conception en génie logiciel
> Institut Supérieur du Sahel
> Email : roykenva...@gmail.com
> Tel: +237 22 11 01 87/ +237 676 94 23 01 / +237 699 04 0612
> 


Reply via email to