trenck Posted October 4, 2009 Report Share Posted October 4, 2009 Hi Pete, I'm not a C++ expert, and I have some difficulties for reading a string (offset 0x3500 ATC aircraft model). I cannot find any example on reading an FSUIPC string, like it exists for DWORD values in SDK documentation. Tanks in advance for Help. Link to comment Share on other sites More sharing options...
Pete Dowson Posted October 4, 2009 Report Share Posted October 4, 2009 I'm not a C++ expert, and I have some difficulties for reading a string (offset 0x3500 ATC aircraft model). I cannot find any example on reading an FSUIPC string, like it exists for DWORD values in SDK documentation. A string is merely an array of bytes. Declare a variable large enough, then read the correct number of bytes directly into it. Whilst there are 2 bytes in a WORD and 4 in a DWORD, and 8 in a double, there are almost any number of bytes in a string -- the offset list will tell you the maximum. The address you supply for the FSUIPC read will need to be the byte address of the first byte of the byte array into which you read the string. For example, if you define: char szATCmodel[24]; DWORD dwResult; then the FSUIPC_Read could be FSUIPC_Read(0x3500, 24, (BYTE *) &szATCmodel[0], &dwResult); or, because C/C++ takes the name of an array as the address of its first element: FSUIPC_Read(0x3500, 24, (BYTE *) szATCmodel, &dwResult); I only cast the address by "(BYTE *)" to stop the compiler giving warnings if you are using signed characters instead of unsigned ones ("BYTE" is defined as an unsigned character). Regards Pete Link to comment Share on other sites More sharing options...
trenck Posted October 4, 2009 Author Report Share Posted October 4, 2009 Many thanks Pete, works fine !! And congratulations for fsuipc... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now