Click here to Skip to main content
15,914,071 members
Home / Discussions / C#
   

C#

 
GeneralWindow Position Pin
dbetting9-Oct-04 10:59
dbetting9-Oct-04 10:59 
GeneralRe: Window Position Pin
Stefan Troschuetz9-Oct-04 22:50
Stefan Troschuetz9-Oct-04 22:50 
GeneralRe: Window Position Pin
dbetting10-Oct-04 3:11
dbetting10-Oct-04 3:11 
GeneralRe: Window Position Pin
Stefan Troschuetz10-Oct-04 7:07
Stefan Troschuetz10-Oct-04 7:07 
GeneralWriting hex values to a file Pin
cgcrute9-Oct-04 6:50
cgcrute9-Oct-04 6:50 
GeneralRe: Writing hex values to a file Pin
Heath Stewart9-Oct-04 8:01
protectorHeath Stewart9-Oct-04 8:01 
GeneralRe: Writing hex values to a file Pin
cgcrute10-Oct-04 7:46
cgcrute10-Oct-04 7:46 
GeneralRe: Writing hex values to a file Pin
Heath Stewart10-Oct-04 11:05
protectorHeath Stewart10-Oct-04 11:05 
I definitely think it's the encoding, especially if it worked under Unicode. If you're trying to write binary data, though, you can just use the FileStream itself instead of a BinaryWriter. You also should take a look at the using statement to make sure the streams are disposed, like so:
using (FileStream file = new FileStream(...))
{
  // write to the file. When 'file' goes out of context - even if an
  // exception is thrown - the file handle is freed.
}
Sorry, just something I really think people should do when working with objects with ties to native resources.

Anyway, anything over 0x7f using encodings like UTF8 mean that 2 bytes should be used. IIRC, some codepages work this way, too. So, make sure you're using the right codepage (you can pass this to the Encoding class you need).

If I were you - and I do this a lot - dig through the IL using ildasm.exe or a decompiler like ".NET Reflector" to trace through the code itself to see what happens when you call BinaryWriter.Write or BinaryWriter.WriteLine and see how the Encoding class is used. Then see how the Encoding class derivative you're using works.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralAdd dropdownlist to datalist Pin
macsgirl9-Oct-04 6:14
macsgirl9-Oct-04 6:14 
GeneralRe: Add dropdownlist to datalist Pin
Heath Stewart9-Oct-04 7:50
protectorHeath Stewart9-Oct-04 7:50 
GeneralRe: Add dropdownlist to datalist Pin
macsgirl9-Oct-04 8:04
macsgirl9-Oct-04 8:04 
GeneralRe: Add dropdownlist to datalist Pin
Heath Stewart9-Oct-04 11:43
protectorHeath Stewart9-Oct-04 11:43 
GeneralNDoc 1.2 Problems Pin
Kevin McFarlane9-Oct-04 5:12
Kevin McFarlane9-Oct-04 5:12 
GeneralRe: NDoc 1.2 Problems Pin
Colin Angus Mackay9-Oct-04 5:49
Colin Angus Mackay9-Oct-04 5:49 
GeneralRe: NDoc 1.2 Problems Pin
Kevin McFarlane9-Oct-04 6:43
Kevin McFarlane9-Oct-04 6:43 
GeneralRe: NDoc 1.2 Problems Pin
Heath Stewart9-Oct-04 7:41
protectorHeath Stewart9-Oct-04 7:41 
Generalhide form from close button Pin
Mridang Agarwalla9-Oct-04 3:40
Mridang Agarwalla9-Oct-04 3:40 
GeneralRe: hide form from close button Pin
Colin Angus Mackay9-Oct-04 3:56
Colin Angus Mackay9-Oct-04 3:56 
GeneralRe: hide form from close button Pin
Colin Angus Mackay16-Oct-04 6:11
Colin Angus Mackay16-Oct-04 6:11 
GeneralRe: hide form from close button Pin
Anonymous17-Oct-04 0:13
Anonymous17-Oct-04 0:13 
GeneralRe: hide form from close button Pin
Colin Angus Mackay17-Oct-04 1:20
Colin Angus Mackay17-Oct-04 1:20 
Generalwav managing Pin
jeroni_brunet9-Oct-04 3:32
jeroni_brunet9-Oct-04 3:32 
GeneralRe: wav managing Pin
Colin Angus Mackay9-Oct-04 4:07
Colin Angus Mackay9-Oct-04 4:07 
GeneralRe: wav managing Pin
jeroni_brunet9-Oct-04 9:28
jeroni_brunet9-Oct-04 9:28 
GeneralRe: wav managing Pin
Colin Angus Mackay9-Oct-04 9:39
Colin Angus Mackay9-Oct-04 9:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.