jakelamon Posted November 3, 2012 Report Posted November 3, 2012 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!
Pete Dowson Posted November 5, 2012 Report Posted November 5, 2012 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
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