Click here to Skip to main content
15,867,568 members
Home / Discussions / C#
   

C#

 
GeneralRe: Microsoft Exchange programming Pin
Stephane Rodriguez.2-Oct-02 4:18
Stephane Rodriguez.2-Oct-02 4:18 
GeneralCalling COM Object in C# Pin
RAVI H R1-Oct-02 20:06
RAVI H R1-Oct-02 20:06 
GeneralRe: Calling COM Object in C# Pin
Stephane Rodriguez.1-Oct-02 20:44
Stephane Rodriguez.1-Oct-02 20:44 
GeneralRe: Calling COM Object in C# Pin
RAVI H R1-Oct-02 23:05
RAVI H R1-Oct-02 23:05 
GeneralRe: Calling COM Object in C# Pin
Stephane Rodriguez.1-Oct-02 23:41
Stephane Rodriguez.1-Oct-02 23:41 
GeneralRe: Calling COM Object in C# Pin
RAVI H R2-Oct-02 0:29
RAVI H R2-Oct-02 0:29 
GeneralHelp reading a binary file Pin
David Williams1-Oct-02 13:36
David Williams1-Oct-02 13:36 
GeneralRe: Help reading a binary file Pin
leppie1-Oct-02 14:35
leppie1-Oct-02 14:35 
David Williams wrote:
I'd like to read them in directly to ushort. Sounds simple. Is it?

It does sound simple, especially if you see how a mapping of the will look. Unfortunately there is no direct way.

I would make a class deriving from FileStream and overload the Read method with some thing like this:

public ushort ReadUShort()
{
  return (ushort) ((ReadByte() << 8) + ReadByte()); //not sure about my bit operations also order :zzz: CHECK IT!
}

public int Read( ushort[] buffer, int offset, int length)
{
  Position += offset;
  int i = 0;
  if (CanRead) {
    for (; i < length; i++)
    {
      buffer[i] = ReadUShort();
    }
  }
  return i;
}


You can try that, someone might have an easier idea Unsure | :~

Hope this helps Smile | :)

Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
GeneralRe: Help reading a binary file Pin
David Williams2-Oct-02 7:06
David Williams2-Oct-02 7:06 
GeneralRe: Help reading a binary file Pin
leppie2-Oct-02 9:30
leppie2-Oct-02 9:30 
GeneralRe: Help reading a binary file Pin
30-Oct-02 8:45
suss30-Oct-02 8:45 
GeneralRe: Help reading a binary file Pin
Paul Riley2-Oct-02 4:50
Paul Riley2-Oct-02 4:50 
GeneralRe: Help reading a binary file Pin
James T. Johnson2-Oct-02 5:38
James T. Johnson2-Oct-02 5:38 
GeneralRe: Help reading a binary file Pin
Paul Riley2-Oct-02 5:44
Paul Riley2-Oct-02 5:44 
GeneralRe: Help reading a binary file Pin
David Williams2-Oct-02 7:10
David Williams2-Oct-02 7:10 
GeneralRe: Help reading a binary file Pin
Eric Gunnerson (msft)2-Oct-02 11:30
Eric Gunnerson (msft)2-Oct-02 11:30 
GeneralRe: Help reading a binary file Pin
leppie2-Oct-02 11:39
leppie2-Oct-02 11:39 
GeneralRe: Help reading a binary file Pin
David Williams3-Oct-02 7:00
David Williams3-Oct-02 7:00 
GeneralRe: Help reading a binary file Pin
David Williams3-Oct-02 7:38
David Williams3-Oct-02 7:38 
GeneralRe: Help reading a binary file Pin
Eric Gunnerson (msft)3-Oct-02 8:17
Eric Gunnerson (msft)3-Oct-02 8:17 
GeneralPopUp A form in Multi-window environment Pin
Chris#1-Oct-02 5:43
Chris#1-Oct-02 5:43 
GeneralRe: PopUp A form in Multi-window environment Pin
Stephane Rodriguez.1-Oct-02 7:13
Stephane Rodriguez.1-Oct-02 7:13 
GeneralRe: PopUp A form in Multi-window environment Pin
leppie1-Oct-02 7:15
leppie1-Oct-02 7:15 
GeneralUrls from Internet Explorer Pin
csharpthomas1-Oct-02 4:08
csharpthomas1-Oct-02 4:08 
GeneralRe: Urls from Internet Explorer Pin
Stephane Rodriguez.1-Oct-02 7:15
Stephane Rodriguez.1-Oct-02 7:15 

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.