Jump to content
The simFlight Network Forums

simple read and write commands


Recommended Posts

Hey all,

I have a pretty basic C program - where I want to read a value and return the value back based on a keypress, I can write out the value within the program fine, but having trouble understanding the read/write combo.

So for example if I wanted to do:

if (FSUIPC_Read(0x53C1, 1 AP, &dwResult)) || (FSUIPC_Write(0x53C1, 1, AP, &dwResult))

FSUIPC_Process(&dwResult)

I'm having trouble achieving to read and then writing out even if I have the relevant commands in fsuipc_io as well

Thanks for any help!

Link to comment
Share on other sites

if (FSUIPC_Read(0x53C1, 1 AP, &dwResult)) || (FSUIPC_Write(0x53C1, 1, AP, &dwResult))

Since when successful the FSUIPC_Read call returns "TRUE", the FSUIPC_Write function will only ever be called if the Read fails! surely that is the opposite of what you want.

Remember, in C conditional combinations are only evaluated as far as is necessary to determine the result.

Try && instead of ||.

Pete

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.