What is podcasting?
Binary text file manipulation
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > .Net Development > Binary text file manipulation 24 November 2004 16:22:23

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

Binary text file manipulation

Richard Barker 24 November 2004 16:22:23
 Hi


I am FTP'ing some fixed length ascii text files from an mainframe computer
to my windows box and importing them into an SQL data warehouse. The problem
I have is, if I use ascii as a transfer option, some of the European
characters disappear from the text. If I use the binary option, they appear
correctly, but the carriage returns and line feeds are, effectively,
missing, so the file is one big blob.

I need to restore the file, so each record length is 318 bytes.

What is the easiest way in C# to do this.








===================­===============
This message contains confidential information and is intended solely for
the use of the individual or entity to whom it is addressed. If you are not
the named addressee you should not disseminate, distribute or copy this
email. Please inform the sender immediately if you have received this e-mail
by mistake and delete this email from your system. Email transmission cannot
be guaranteed to be secure or error-free as information could be
intercepted, corrupted, lost, destroyed, arrive late or be incomplete. The
sender therefore does not accept liability for any errors or omissions in
the contents of this message, which arise as a result of email transmission.
If verification is required please request a hard copy version. No contracts
may be concluded on behalf of Virgin Express SA/NV by means of email
communication. Finally, the recipient should check this e-mail and any
attachments for the presence of viruses. The company accepts no liability
for any damage caused by any virus transmitted by this email.
===================­===============

===================­================
This list is hosted by DevelopMentorВ® http://www.develop.­com
Some .NET courses you may be interested in:

Programming C#
November 15-19, in Los Angeles
http://www.develop.­com/courses/csharp

View archives and manage your subscription(s) at http://discuss.deve­lop.com

Add comment
Paul Stevens 24 November 2004 15:59:39 permanent link ]
 Unix uses only a carriage return so the linefeed character is missing doing
an ASCII ftp inserts the missing line feed character but sometimes destroys
other data, you should be able to get away with replacing all carriage
return characters with a carriage return & linefeed character.

-----Original Message-----
From: Discussion relating to the specifics of the C# and Managed C++
languages [mailto:D­OTNET-CX@DISCUSS.DEVELOP.COM] On Behalf Of Richard Barker
Sent: 24 November 2004 11:55 AM
To: DOTNET-CX@DISCUSS.D­EVELOP.COM
Subject: [DOTNET-CX] Binary text file manipulation

Hi


I am FTP'ing some fixed length ascii text files from an mainframe computer
to my windows box and importing them into an SQL data warehouse. The problem
I have is, if I use ascii as a transfer option, some of the European
characters disappear from the text. If I use the binary option, they appear
correctly, but the carriage returns and line feeds are, effectively,
missing, so the file is one big blob.

I need to restore the file, so each record length is 318 bytes.

What is the easiest way in C# to do this.








===================­===============
This message contains confidential information and is intended solely for
the use of the individual or entity to whom it is addressed. If you are not
the named addressee you should not disseminate, distribute or copy this
email. Please inform the sender immediately if you have received this e-mail
by mistake and delete this email from your system. Email transmission cannot
be guaranteed to be secure or error-free as information could be
intercepted, corrupted, lost, destroyed, arrive late or be incomplete. The
sender therefore does not accept liability for any errors or omissions in
the contents of this message, which arise as a result of email transmission.
If verification is required please request a hard copy version. No contracts
may be concluded on behalf of Virgin Express SA/NV by means of email
communication. Finally, the recipient should check this e-mail and any
attachments for the presence of viruses. The company accepts no liability
for any damage caused by any virus transmitted by this email.
===================­===============

===================­================
This list is hosted by DevelopMentor(r) http://www.develop.­com
Some .NET courses you may be interested in:

Programming C#
November 15-19, in Los Angeles
http://www.develop.­com/courses/csharp

View archives and manage your subscription(s) at http://discuss.deve­lop.com

*******************­********************­********************­********************­********************­********************­***
Everything in this e-mail and attachments relating to the official business of MultiChoice Africa is proprietary to
the company. Any view or opinion expressed in this message may be the view of the individual and should not automatically
be ascribed to the company. If you are not the intended recipient, you may not peruse, use, disseminate, distribute or
copy this message. If you have received this message in error, please notify the sender immediately by email, facsimile
or telephone and destroy the original message.
*******************­********************­********************­********************­********************­********************­***

===================­================
This list is hosted by DevelopMentor® http://www.develop.­com
Some .NET courses you may be interested in:

Programming C#
November 15-19, in Los Angeles
http://www.develop.­com/courses/csharp

View archives and manage your subscription(s) at http://discuss.deve­lop.com

Add comment
Paul Stevens 24 November 2004 16:01:31 permanent link ]
 BTW the string.Replace() only allows you to replace a character with another
character AFAIK, a workaround might be to reference the VB namespace and use
the VB replace which allows you to replace a string with another string or
in your case one character "\r" with two characters "\r\n".

-----Original Message-----
From: Discussion relating to the specifics of the C# and Managed C++
languages [mailto:D­OTNET-CX@DISCUSS.DEVELOP.COM] On Behalf Of Richard Barker
Sent: 24 November 2004 11:55 AM
To: DOTNET-CX@DISCUSS.D­EVELOP.COM
Subject: [DOTNET-CX] Binary text file manipulation

Hi


I am FTP'ing some fixed length ascii text files from an mainframe computer
to my windows box and importing them into an SQL data warehouse. The problem
I have is, if I use ascii as a transfer option, some of the European
characters disappear from the text. If I use the binary option, they appear
correctly, but the carriage returns and line feeds are, effectively,
missing, so the file is one big blob.

I need to restore the file, so each record length is 318 bytes.

What is the easiest way in C# to do this.








===================­===============
This message contains confidential information and is intended solely for
the use of the individual or entity to whom it is addressed. If you are not
the named addressee you should not disseminate, distribute or copy this
email. Please inform the sender immediately if you have received this e-mail
by mistake and delete this email from your system. Email transmission cannot
be guaranteed to be secure or error-free as information could be
intercepted, corrupted, lost, destroyed, arrive late or be incomplete. The
sender therefore does not accept liability for any errors or omissions in
the contents of this message, which arise as a result of email transmission.
If verification is required please request a hard copy version. No contracts
may be concluded on behalf of Virgin Express SA/NV by means of email
communication. Finally, the recipient should check this e-mail and any
attachments for the presence of viruses. The company accepts no liability
for any damage caused by any virus transmitted by this email.
===================­===============

===================­================
This list is hosted by DevelopMentor(r) http://www.develop.­com
Some .NET courses you may be interested in:

Programming C#
November 15-19, in Los Angeles
http://www.develop.­com/courses/csharp

View archives and manage your subscription(s) at http://discuss.deve­lop.com

*******************­********************­********************­********************­********************­********************­***
Everything in this e-mail and attachments relating to the official business of MultiChoice Africa is proprietary to
the company. Any view or opinion expressed in this message may be the view of the individual and should not automatically
be ascribed to the company. If you are not the intended recipient, you may not peruse, use, disseminate, distribute or
copy this message. If you have received this message in error, please notify the sender immediately by email, facsimile
or telephone and destroy the original message.
*******************­********************­********************­********************­********************­********************­***

===================­================
This list is hosted by DevelopMentor® http://www.develop.­com
Some .NET courses you may be interested in:

Programming C#
November 15-19, in Los Angeles
http://www.develop.­com/courses/csharp

View archives and manage your subscription(s) at http://discuss.deve­lop.com

Add comment
Adrian Martin 24 November 2004 16:09:32 permanent link ]
 Convert the char to a string first
MessageBox.Show( "line1\nline2".Repl­ace( '\n'.ToString() , "\r" ) );



Opinions expressed in this e-mail are those of the writer and not the company. E-mail traffic is monitored within Johnston Press and messages may be viewed. This e-mail and any files with it are solely for the use of the addressee(s). If you are not the intended recipient, you have received this e-mail in error. Please delete it or return it to the sender or notify us by email at postmaster@jpress.c­o.uk

===================­================
This list is hosted by DevelopMentor http://www.develop.­com
Some .NET courses you may be interested in:

Programming C#
November 15-19, in Los Angeles
http://www.develop.­com/courses/csharp

View archives and manage your subscription(s) at http://discuss.deve­lop.com

Add comment
Jon Skeet 24 November 2004 16:22:23 permanent link ]
 Paul Stevens wrote:> BTW the string.Replace() only allows you to replace a character with another> character AFAIK, a workaround might be to reference the VB namespace and use> the VB replace which allows you to replace a string with another string or> in your case one character "\r" with two characters "\r\n".

No, you're wrong. There are two overloads for string.Replace - one is
string.Replace(char­, char), and the other is string.Replace (string,
string). No need to look to VB.

Jon

===================­================
This list is hosted by DevelopMentorВ® http://www.develop.­com
Some .NET courses you may be interested in:

Programming C#
November 15-19, in Los Angeles
http://www.develop.­com/courses/csharp

View archives and manage your subscription(s) at http://discuss.deve­lop.com

Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > .Net Development > Binary text file manipulation 24 November 2004 16:22:23

see also:
Announcement: Smarty template engine…
Strange include
Session_destroy problems...
пройди тесты:
see also:
Nada nemnogo zapolnit dnev...
Aaaaaaaaaaaaaa!!!! Where all…
C prazdnikom vcex!

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .