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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.