Urgent ! SOS ! How to remove CRLF in file

TazNormand

Member
Joined
Jul 6, 2005
Messages
11
Programming Experience
5-10
[RESOLVED]Urgent ! SOS ! How to remove CRLF in file

Hi

1st of all i'm french so excuse my bad english,

my problem is :

I have a mainframe (Bull Gcos7) which transfer to a W2K server an EBCDIC file with record separator (CR & LF),

I 've developped a tool that zip it and FTP it to another site

But the other site asks me to remove the CRLF codes in my file (original not zip)

My method was to open another file with streamwriter, and make replace of vbcrlf by "Nothing" ===> not working

Second method, same streamwriter but used Trim(vbcrlf) ==> not working too

So, how can i remove the [EDIT] CRLF code from my file before zipping it ????

Please help me it's very urgent.

Thanx
 
Last edited:
Hi

Is'm sorry but last post doesn't work

I thought that Bianry reading could help me but noway too.

i'm desperate

streamreader doesnt take care of crlf, when i add a spy on my value, crlf codes don't appear.

help me

i'm near suicide me ;-)

thanx
 
What do you mean by "the last post doesn't work"? Are you saying that you use that code and the resultant string still has new line characters in it? What do you mean by "when I add a spy on my value, crlf codes don't appear"? If they don't appear then there are none, whioch is what you want isn't it? I don't really understand what you're trying to say.
 
HI again

I have resolved my problem :D :cool:

the answer is very simple : no replace use
just use a readline for streamreader, bu not writeline for output file , i use a write !!!
thanx jmcilhinney for your help, sorry to answered you so bad
this is my code for further help to other users :

VB.NET:
[color=#0000ff]Dim[/color] Fichier_Entree [color=#0000ff]As[/color] System.IO.StreamReader 
[color=#0000ff]Dim[/color] Fichier_Sortie [color=#0000ff]As[/color] System.IO.StreamWriter 
[color=#0000ff]Dim[/color] Rec_Out [color=#0000ff]As[/color][color=#0000ff]String[/color] = "" 
[color=#0000ff]Dim[/color] Rec_in [color=#0000ff]As[/color][color=#0000ff]String 
[/color]
 
 
 
 
 


[color=#0000ff]Try[indent][/color]Fichier_Entree = [color=#0000ff]New[/color] System.IO.StreamReader(FichIn, system.Text.Encoding.ASCII, [color=#0000ff]False[/color], 158) 

 
Fichier_Sortie = [color=#0000ff]New[/color] System.IO.StreamWriter(FichIn & "-2") 
[color=#0000ff]While[/color] Fichier_Entree.Peek() > -1

[/indent][indent][indent]Rec_in = Fichier_Entree.ReadLine[color=#008000]

 
[/color][color=#0000ff]Dim[/color] toto [color=#0000ff]As[/color][color=#0000ff]Long[/color] = Rec_in.Length 
Fichier_Sortie.Write(Rec_in)[color=#008000] 
 

[/indent][/indent][indent][/color][color=#0000ff]End[/color][color=#0000ff]While

 
 

[/indent][/color][color=#0000ff]Catch[/color] erreur [color=#0000ff]As[/color] Exception[indent]MsgBox("erreur " & erreur.Message)[/indent][color=#0000ff]End[/color][color=#0000ff]Try

 
[/color]Fichier_Entree.Close()
Fichier_Sortie.Close()
 
Back
Top