Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Delphi
  4. Converting data froma 12 byte array to a string value

Converting data froma 12 byte array to a string value

Scheduled Pinned Locked Moved Delphi
data-structurestoolsperformancequestion
7 Posts 2 Posters 39 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 14803461
    wrote on last edited by
    #1

    Hi all Not sure if this is active anymore but here goes I have written a utility that goes with MS Flight Sim and I have been reading data from the Sim Program and displaying it with no trouble at all doing numbers etc for Speed and altitude. But I can not get Data for things that are stored in multi byte Arrays converted to a string. Code Follows if FSUIPC_Read($3130, 12, @AircraftType, dwResult) then begin if FSUIPC_Process(dwResult) then begin // How do I convert @aircraftType to a string // that I can then send to LabelFSAircraftType.Caption := end else begin LabelFSAircraftType.Caption := 'Processing: ' + ResultText[dwResult]; end; end else begin LabelFSAircraftType.Caption := 'Reading: ' + ResultText[dwResult]; end; Hopefully somebody will have some ideas Owen Moore

    L 1 Reply Last reply
    0
    • M Member 14803461

      Hi all Not sure if this is active anymore but here goes I have written a utility that goes with MS Flight Sim and I have been reading data from the Sim Program and displaying it with no trouble at all doing numbers etc for Speed and altitude. But I can not get Data for things that are stored in multi byte Arrays converted to a string. Code Follows if FSUIPC_Read($3130, 12, @AircraftType, dwResult) then begin if FSUIPC_Process(dwResult) then begin // How do I convert @aircraftType to a string // that I can then send to LabelFSAircraftType.Caption := end else begin LabelFSAircraftType.Caption := 'Processing: ' + ResultText[dwResult]; end; end else begin LabelFSAircraftType.Caption := 'Reading: ' + ResultText[dwResult]; end; Hopefully somebody will have some ideas Owen Moore

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Member 14803461 wrote:

      // How do I convert @aircraftType to a string

      It depends what it contains in the first place, and what is passed in to your program at that point.

      M 2 Replies Last reply
      0
      • L Lost User

        Member 14803461 wrote:

        // How do I convert @aircraftType to a string

        It depends what it contains in the first place, and what is passed in to your program at that point.

        M Offline
        M Offline
        Member 14803461
        wrote on last edited by
        #3

        I realise that. Aircraft type is actually text in the flight sim eg :Airbus A 330 . Documentation says it is limited to 12 characters including a zero terminator. I was assuming it was 12 bytes but maybe I am wrong. It may be just a string

        1 Reply Last reply
        0
        • L Lost User

          Member 14803461 wrote:

          // How do I convert @aircraftType to a string

          It depends what it contains in the first place, and what is passed in to your program at that point.

          M Offline
          M Offline
          Member 14803461
          wrote on last edited by
          #4

          Hi Richard I have been doing some testing and find hat if I set a Var of AircraftType: Array [1..12] of byte then Code of if FSUIPC_Read($3130, 12, @AircraftType, dwResult) then begin if FSUIPC_Process(dwResult) then begin label20.Caption :=ResultText[dwResult]; Etc etc Label20 gives me an ok which makes me think It is getting the data correctly but I dont know how to change it so I can see the data as a string to be attached to a label Owen

          L 1 Reply Last reply
          0
          • M Member 14803461

            Hi Richard I have been doing some testing and find hat if I set a Var of AircraftType: Array [1..12] of byte then Code of if FSUIPC_Read($3130, 12, @AircraftType, dwResult) then begin if FSUIPC_Process(dwResult) then begin label20.Caption :=ResultText[dwResult]; Etc etc Label20 gives me an ok which makes me think It is getting the data correctly but I dont know how to change it so I can see the data as a string to be attached to a label Owen

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Without knowing exactly what is in the data that you are receiving it is impossible to suggest anything.

            M 2 Replies Last reply
            0
            • L Lost User

              Without knowing exactly what is in the data that you are receiving it is impossible to suggest anything.

              M Offline
              M Offline
              Member 14803461
              wrote on last edited by
              #6

              Thanks for your time. I will see if I can find out Owen

              1 Reply Last reply
              0
              • L Lost User

                Without knowing exactly what is in the data that you are receiving it is impossible to suggest anything.

                M Offline
                M Offline
                Member 14803461
                wrote on last edited by
                #7

                Sometimes you cant see the wood for the trees. Got it all sorted thanks. It is actually stored as ascii Characters Thanks Owen

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups