Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 16th, 2004, 03:29 PM
Registered User
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Differences between ASCII and Binary Files

Can someone help me figure out the difference between an ASCII file and a binary file as it pertains to reading and writing those kinds of files?

Many Thanks,


Old October 17th, 2004, 07:22 PM
Kep Kep is offline
Authorized User
Join Date: Aug 2003
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts

I think what you're asking is how to read text files as opposed to binary files?

It just relates to how you deal with things like new lines, tabs and other special characters.

All files can be read using the FileStream object. This object allows you to read and write byte arrays to/from a file. This would be your option for a "binary" file (although you could read/write a text file using this object).

For text files you can use a StreamReader or StreamWriter. This allows you to read/write text files in a logical way, i.e. one line at a time into a string variable.

At the lowest level all files are stored as binary, it's just a matter of how you choose to view that file when reading or writing.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting an ASCII character to binary? skyraider Visual Basic 2005 Basics 0 May 7th, 2006 08:20 PM
hex conversion to binary files chrispbrown2255 C++ Programming 1 March 15th, 2006 06:06 PM
Format of Inet Object in vb6..ASCII/BINARY? ksrmramu VB How-To 0 October 18th, 2005 02:45 AM
Binary files MAXhYpe C# 0 November 2nd, 2004 04:42 AM
Reading from Binary Files jschmi J2EE 0 October 5th, 2004 01:09 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.