Autor Beitrag
DerHorst
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 31

windows200
delphi 6 PE
BeitragVerfasst: Sa 09.10.04 11:49 
grüß euch.

gibt es eine möglichkeit in inhalt (egal welcher) eines memory streams in eine integer variable zu laden und umgekehrt?


grüße

horst


Moderiert von user profile icontommie-lie: Topic aus VCL (Visual Component Library) verschoben am Sa 09.10.2004 um 12:59
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Sa 09.10.04 11:59 
Ja.
:mrgreen:

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
Elite
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 09.10.04 12:04 
Jawohl, das geht. :lol:
DerHorst Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 31

windows200
delphi 6 PE
BeitragVerfasst: Sa 09.10.04 14:15 
oh das ist gut.

vielen dank für eure antworten.


grüße

Horst












ps: ach so und wie gehts das?
Elite
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 09.10.04 14:25 
Achsoo, frag das doch gleich ^^

Ein Integer ist immer 4 Byte groß. Das heißt sobald Stream.Size >= 4 ist kann man mindestens eine Integer-Variable rausholen. Ab 8 Byte halt 2 stück etc...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
function LoadIntFromStream(Stream: TStream): integer;
begin
 Stream.ReadBuffer(result, SizeOf(Result));
end;


Habs net getestet, aber müsste gehen.
.Chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1112



BeitragVerfasst: Sa 09.10.04 14:26 
Die Jungs haben korrekt auf deine Frage geantwortert. ;-)

Nimm ReadBuffer, und setze als Ziel einfach deinen Integer ein.

Edit: Mal wieder gleichzeitig ...

_________________
Die Antworten auf die 5 häufigsten Fragen:
1. Copy(), Pos(), Length() --- 2. DoubleBuffered:=True; --- 3. Application.ProcessMessages bzw. TThread --- 4. ShellExecute() --- 5. Keine Vergleiche von Real-Typen mit "="!