Never mind,
the problem was else where, WriteByte can handle it.
"Dan V." <danv@yah.com> wrote in message
news:eGNX06SOEHA.2468@TK2MSFTNGP11.phx.gbl...[color=blue]
> Now I am trying to get rid of that '@' symbol from a string, which I use
> previously.
> I don't want to write that '@' symbol to the file and WriteByte seems to[/color]
try[color=blue]
> to do this.
>
> s = @"c:\text1.txt"
>
> bytes = Encoding.UTF8.GetBytes(s);
>
> fs.Write(bytes, 0, bytes.Length);
>
>
> "Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
> news:MPG.1b0daf66f633eebb98a8d5@msnews.microsoft.c om...[color=green]
> > Dan V. <danv@yah.com> wrote:[color=darkred]
> > > You must be thinking - "did he really understand those articles..."[/color]
> >
> > Only a *little* bit :)
> >[color=darkred]
> > > Is this the point then?
> > >
> > > string.Length may not equal bytes.length because:
> > > 1) some characters may not equal exactly one byte (even though in my[/color][/color]
> case[color=green][color=darkred]
> > > it did)[/color]
> >
> > Indeed. It will depend on the encoding and the characters being
> > encoded. For instance, using Encoding.Unicode you will always get twice
> > as many bytes as characters. Using Encoding.ASCII you'll always get
> > exactly the same number of bytes as characters (but you can only
> > properly encode characters 0-127). Using Encoding.UTF8 you'll get a
> > variable number depending on the character - ASCII values still end up
> > as one byte, but the number of bytes grows depending on the characters.
> > In fact, UTF-8 is even more complicated, because surrogate pairs should
> > be encoded into a single 6-byte UTF-8 sequence, rather than two 4-byte
> > sequences. Nasty stuff!
> >[color=darkred]
> > > 2) some characters (if I used non 'English' ones may be more than[/color][/color][/color]
one[color=blue][color=green][color=darkred]
> > > byte) - I am recalling that in UTF8 ANSI and ASCII, they use only[/color][/color][/color]
one[color=blue]
> byte[color=green][color=darkred]
> > > only for most 'English' characters and 2 or more bytes for the rest...[/color]
> >
> > "ANSI" isn't a single character set - but UTF8 and ASCII are certainly
> > one byte per character for all ASCII characters.
> >
> > --
> > Jon Skeet - <skeet@pobox.com>
> >
http://www.pobox.com/~skeet
> > If replying to the group, please do not mail me too[/color]
>
>[/color]