Autor Beitrag
Gabe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Do 24.09.09 11:47 
Hallo zusammen,

Ich habe hier mehrere Integer-Werte die hochgezählt werden. Diese Werte möchte ich auf ein byte[] verteilen. Gibt's da ne fertige Methode?

Bsp:

Wert 255

Byte[0] = 255;
Byte[1] = 0;

Wie kann ich jetzt den Wert auf das nächste Byte zuweisen, wenn der Wert > 255?

Danke für die Antworten.
gfoidl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 157
Erhaltene Danke: 19

Win XP
C#, Fortran 95 - Visual Studio
BeitragVerfasst: Do 24.09.09 12:19 
Hallo,

siehe dotnet-forum.de/forums/p/1867/6673.aspx.

Bitte keine Crossposts. Wenigstens die Angabe der anderen Quelle wäre notwendig damit keine doppelte Arbeit entsteht.


mfG Günther

_________________
Alle sagten, das geht nicht! Dann kam einer, der wusste das nicht - und hat's gemacht!
Gabe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Do 24.09.09 19:05 
Im anderen Forum gelöst.

ausblenden C#-Quelltext
1:
2:
3:
4:
 
int intTestZahl = 256;
byte[] arrTest = new byte[2];
arrTest = BitConverter.GetBytes(intTestZahl);


Edit: Quelltext als C# dekariert