Autor Beitrag
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Di 20.03.07 21:57 
ich möchte ein paar byte-werte in einen string setzen. also zahlen von 0-127 aber dafür nur ein Byte verwenden

versucht habe ich:
ausblenden Delphi-Quelltext
1:
str:=chr(1)+'hallo'+chr(100)					


aber das geht nicht...der macht bei dem chr(1) schluss

das ganze ist für eine kompression (eine gaaanz einfache)
ich möchte da am anfang eine wortliste anhängen...und die ist im Format: 1String1|2String2|3String3...127String127|
und ich würde ja bis zu 3 Byte brauchen wenn ich das nicht als 1byte speicher
außerdem müsste ich ja das dann erst umständlich wieder auslesen...

jmd eine Idee?

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt


Zuletzt bearbeitet von Flamefire am Di 20.03.07 22:04, insgesamt 2-mal bearbeitet
Saubäär
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 376



BeitragVerfasst: Di 20.03.07 22:01 
Moin,

möchtest du die Zahlen ausgeben? Wenn ja hilft dir IntToStr(); anstatt Chr();

Gruß
Flamefire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Di 20.03.07 22:02 
nein möchte ich nicht...s.o.
habs editiert...
rizla
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 417
Erhaltene Danke: 2

XP
FPC mit Lazarus
BeitragVerfasst: Di 20.03.07 22:09 
hi,
vllt hats ja hiermit zu tun:
de.wikipedia.org/wiki/Steuerzeichen
da die ascii-zeichen ja steuercodes sind, interpretiert delphi die wahrscheinlich..
ich weiß es aber nicht genau.

:r:

_________________
if you have what they want - they'll find a way to take it (bruce sterling)
WOW - 10 JAHRE Mitglied beim Delphi-Forum. Wie die Zeit vergeht, Freunde.
Flamefire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Di 20.03.07 22:11 
ja das wirds sein...aber wie komm ich da drumrum?
oder muss ich wirklich 3byte verwenden um 1 byte darzustellen?
rizla
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 417
Erhaltene Danke: 2

XP
FPC mit Lazarus
BeitragVerfasst: Di 20.03.07 22:19 
nee, um ein byte dazustellen brauchst du ein byte, ist schon richtig.
vllt solltest du nicht strings nehmen, sondern ein anderes konstrukt.
das selbe problem entsteht ja, wenn man ne binärdatei mit meinetwegen dem editor öffent,
sobald das steuerzeichen ETX (also end of text) kommt, ist vorbei..

_________________
if you have what they want - they'll find a way to take it (bruce sterling)
WOW - 10 JAHRE Mitglied beim Delphi-Forum. Wie die Zeit vergeht, Freunde.
Flamefire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Mi 21.03.07 07:55 
ja ebn...das ist mein problem...

die komprimierung läuft so ab:
wortliste laden, jedes wort durch den Index ersetzen

da hab ich 2 probleme: was ist wenn in der textdatei schon zahlen drin sind oder ein wort der wortliste ohne leerzeichen vor einer zahl steht?
rizla
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 417
Erhaltene Danke: 2

XP
FPC mit Lazarus
BeitragVerfasst: Mi 21.03.07 18:26 
also ist das problem ganz grundsätzlich..
ich weiß nicht, aber vllt solltest du dir mal kompressionsverfahren an sich anschauen
siehe hier: de.wikipedia.org/wik...pressionsalgorithmus
speziell die LZ*-Verfahren, das sind wörterbuchbasierende Verfahren. Und dann mal hier im DF suchen, da findest Du z.B. sowas:
www.delphi-forum.de/...hlight=komprimierung

_________________
if you have what they want - they'll find a way to take it (bruce sterling)
WOW - 10 JAHRE Mitglied beim Delphi-Forum. Wie die Zeit vergeht, Freunde.