Autor Beitrag
seddto
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Fr 02.04.04 11:46 
Hallo,

Ich möchte eine Datei im Hexformat einlesen und im Hexformat in eine neue Datei schreiben. Weiss jemand wie das geht? Außerdem würde ich gerne wissen, wie es möglich ist den normalerweise über Filepos() ermittelten wert in die entsprechende HEX-Offset-adresse umzuwandeln.

Danke & Liebe grüsse

seddto
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Fr 02.04.04 19:23 
hi

IntToHex dürfte dir hier helfen.


raziel

_________________
JSXGraph
seddto Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Sa 03.04.04 14:22 
Danke für die Antwort :) In welchen Variablen Typ kann ich denn hex zahlen reinschreiben und wie kann ich die Hexzahl dann nachher als String ausgeben?
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Sa 03.04.04 14:40 
:?:

Hex ist lediglich eine Darstellungsform von normalen Zahlen. Du liest 4 Bytes aus einer Datei aus in einen Integer oder meinetwegen 8 Bytes in einen Int64 und konvertierst den Wert per IntToHex in Hexadezimal. Das is jetz zwar alles andere als Elegant, aber im Moment das einzige das mir so einfällt dazu. Der Rückgabewert von IntToHex ist ein String! Jedoch könnte er noch ein paar "Zusatzinfos" haben wie ein "$" oder ein "0x" am Anfang oder ein "h" am Ende, hab grad keine Delphi OH zur hand...


raziel

_________________
JSXGraph
seddto Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Sa 03.04.04 15:16 
Also ich habe jetzt mal Versucht die Integer Variable in der ich mit Filepos das Offset gespeichert habe mit inttohex in einen String zu speichern, hier der code:

Off1 := inttohex(Offsetcount); // Off1 = string Offsetcount = Integer

Dabei gibt Delphi7 mir die Fehlermeldung aus "There is no overload version of Inttohex that can be called with this arguments"..Hat jemand eine Ahnung was ich falsch mache?
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Sa 03.04.04 15:26 
probiers mal mit
ausblenden Delphi-Quelltext
1:
Off1 := inttohex(Offsetcount, 1); // Off1 = string Offsetcount = Integer					

ein kleiner blick in die OH (auf inttohex klicken und F1 drücken...) kann nie schaden... ;-)
und laut www.delphibasics.co....TL.asp?Name=IntToHex kannst du das
raziel hat folgendes geschrieben:
Jedoch könnte er noch ein paar "Zusatzinfos" haben wie ein "$" oder ein "0x" am Anfang oder ein "h" am Ende, hab grad keine Delphi OH zur hand...

getrost vergessen...


raziel

_________________
JSXGraph
seddto Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 56



BeitragVerfasst: Sa 03.04.04 18:00 
Danke für die Antwort...geht :)