Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 20:28

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Float in 4 Bytes umwandeln?

Discussion on Float in 4 Bytes umwandeln? within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2009
Posts: 600
Received Thanks: 8,035
Float in 4 Bytes umwandeln?

Hallo,

hab eine Frage wie kann ich einen Float-Wert in einen 4 Bytes Wert umwandeln in CheatEngine geht es ja ganz leicht wenn man einfach den Type ändert, aber wie macht man das in VisualBasic?

ReadFloat und ReadFloatPointer ergeben nicht das richtig Ergebnis.

Wenn ich mit ReadLong den Wert auslese stimmt er mit dem 4 Bytes Wert aus CE überein, also müsst ich nur noch einen Befehl finden der mir den Wert in Float umwandelt.

Danke für nützliche Antworten

MfG Show
ShowUrSkillz is offline  
Old 07/30/2010, 14:32   #2
 
elite*gold: 0
Join Date: Jan 2008
Posts: 21
Received Thanks: 12
in vb.net sollte dir das eigentlich weiterhelfen

byte to float --> BitConverter.ToSingle( bytes, index )
*** to byte --> BitConverter.GetBytes( argument )

(4byte float ist in .net Single)
illstar is offline  
Thanks
1 User
Old 07/30/2010, 18:24   #3
 
elite*gold: 0
Join Date: Dec 2009
Posts: 600
Received Thanks: 8,035
PHP Code:
Dim Value1 As String

BitConverter
.ToSingle(Value14

Ich habs mal ausprobiert aber es kommt immer die Fehlermeldung:

"Der Wert vom Typ "String" kann nicht in ein "1-dimensionales Array von Byte" konvertiert werden."

Bei der Deklaration "Single" passiert das gleiche.
ShowUrSkillz is offline  
Old 07/30/2010, 21:54   #4
 
elite*gold: 0
Join Date: Jan 2008
Posts: 21
Received Thanks: 12
BitConverter.ToSingle akzeptiert keinen string als parameter ... muss ein array aus mindestens 4 byte sein da ein Single 4 byte lange ist

kleines beispiel zum testen:

Code:
        Dim Bytes() As Byte = {&HD7, &HA3, &H25, &H42}
        Dim EinSingle As Single = 12.3456789
        Dim EinInt32 As Int32 = 1234567890

        Console.WriteLine("Die Bytes {0} convertiert in ein Int32  = dezimal {1}", BitConverter.ToString(Bytes), BitConverter.ToInt32(Bytes, 0))
        Console.WriteLine("Die Bytes {0} convertiert in ein Single = dezimal {1}", BitConverter.ToString(Bytes), BitConverter.ToSingle(Bytes, 0))


        Bytes = BitConverter.GetBytes(EinSingle) 'Single to Bytes
        Console.WriteLine("Das Single {0} convertiert in Bytes =  {1}", EinSingle, BitConverter.ToString(Bytes))

        Bytes = BitConverter.GetBytes(EinInt32) 'Int32 to Bytes
        Console.WriteLine("Das Int32  {0} convertiert in Bytes =  {1}", EinInt32, BitConverter.ToString(Bytes))
illstar is offline  
Thanks
1 User
Old 07/30/2010, 22:41   #5
 
elite*gold: 0
Join Date: Dec 2009
Posts: 600
Received Thanks: 8,035
Danke werde aber nicht ganz draus schlau, sorry.

Also ich hab den Wert "1148370570" den will ich in "970,977172851563" umwandeln.
Der Wert "1148370570" ist value1 und soll in value2 konvertiert werden als float.
Als was muss ich dann value1 und value2 deklarieren?

Könntest du mir dazu ein Beispiel geben?

mfg
ShowUrSkillz is offline  
Old 07/30/2010, 22:59   #6
 
elite*gold: 0
Join Date: Jan 2008
Posts: 21
Received Thanks: 12
4 byte version
Code:
Dim str As String = "1148370570"
Dim int As Int32 = CInt(str)                          'string to int32
Dim b() As Byte = BitConverter.GetBytes(int)          'int32  to bytes
Dim float As Single = BitConverter.ToSingle(b, 0)     'bytes  to Single

Console.WriteLine("result: {0}", float)                       '970,9772

8 byte version
Code:
Dim str As String = "1148370570"
Dim int As Int64 = CLng(str)                          'string to int64
Dim b() As Byte = BitConverter.GetBytes(int)          'int64  to bytes
Dim float As Double = BitConverter.ToSingle(b, 0)     'bytes  to Double 

Console.WriteLine("result: {0}", float)                     '970,977172851563
viel spass damit
illstar is offline  
Thanks
1 User
Reply

Tags
4 byte, float, umwandeln, vb, visualbasic


Similar Threads Similar Threads
2 Bytes oder 4 Bytes ?
02/13/2010 - Kal Online - 3 Replies
Erm wenn ich nach cooldowns schaue für Mockery mit der UCE such ich dann mit 2 Bytes oder 4 Bytes ??
How to do the FLY/FLOAT HACK??
05/18/2009 - Grand Chase - 0 Replies
So, i know there is a fly hack, but i don't know how to do it.. Its a hack, where you will 'fly' as if you're on the water fountain in forgotten city.. So, anyone who knows how, PLE*ASE SHARE... **For that someone who will share it.. You deserve my thanks!!:handsdown:
Float Wert
03/13/2009 - GW Bots - 4 Replies
Hallo! Ich würde mir gerne den Float wert von einer Speicheradresse ausgeben lassen: $CurrHealth = _MemoryRead($Health, $hprocess, 'float') Leider gibt es mit und ohne 'float' immer den gleichen wert. Was mach ich denn da falsch?
Bob's 'Float in Mid-Air' Script
03/17/2007 - WoW Exploits, Hacks, Tools & Macros - 16 Replies
Creators Description: "created my own AutoIt script to automate 'floating' in mid-air (via the logout trick). I spent quite a bit of time fine-tuning the timing. Note, however, that lag can intefere with getting a perfect float. For safest use, take the following script, and compile it yourself with AutoIt, so you can use it as a stand-alone exe. Name the exe something ambiguous. The script lets you do 3 differnt kinds of float, activated by F1, F2, F3, respectively. Experiment with...
How to Float
06/27/2005 - WoW Exploits, Hacks, Tools & Macros - 16 Replies
Ripped from BH Required Programs Wow Windows Calculator Tsearch - http://dlh.net/dl.php?lang=eng&dir=gamehac...e rs/TSearch.zip Procedure 1-First you will need to download Tsearch and unzip it.. Make sure wow is open and you are logged into your char.



All times are GMT +1. The time now is 20:29.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.