Jump to content
The simFlight Network Forums

Recommended Posts

Posted

hello everyone,

I am trying to write a basic C++ program to read data from flight sim.

I am able to compile and run my program, however ever i get error code 2 when trying to open the connection to flight stim using FSUIPC_open.

I am able to succesfully run the sample program that comes with the sdk (UIPCHello).

Yes, flight sime is open and I am running my program with admistrator priviliges.

I have attched my code for further reference. Any insight would be greatly appreciated.

#include

#include

#include

#include

#include

#include

using namespace std;

int main()

{

ofstream data;

data.open("data.txt");

DWORD dwResult;

int result;

double *acceleration;

double value;

int i;

FSUIPC_Open(SIM_ANY, &dwResult);

cout<

acceleration=&value;

*acceleration=20.0;

for(i=0;i<10;i++){

FSUIPC_Read(3090,8 , acceleration, &dwResult);

FSUIPC_Process(&dwResult);

result=dwResult;

cout<

data<

Sleep(1000);

}

data.close();

return 0;

}

Posted

I am running my program with admistrator priviliges.

Why? Are you running FS in elevated privileged mode too? You shouldn't have to do either.

I assume you are using Vista? It seems that it prohibits memory-mapped file sharing between programs at different privilege levels. There should be no need to do that.

Regards

Pete

Posted

Yes, I am running Vista.

I've removed 'admistrator mode' from FS, my program and UIPChello. UIPCHello is still able to connect however I am still getting the same error when trying to connect with my program.

Posted
Yes, I am running Vista.

I've removed 'admistrator mode' from FS, my program and UIPChello. UIPCHello is still able to connect however I am still getting the same error when trying to connect with my program.

sorry, I've not really any idea why that should be. Have you tried tracing through your program and the FSUIPC _Open call (the source is provided)?

Just in case it is actually getting connected but receiving bad data, please enable IPC read and IPC write logging in FSUIPC's Logging tab, and try connecting again. Then close FS down and show me the Log file.

Regards

Pete

Posted

I recompiled my code using VS2003 and ran it on a XP machine and everything is working fine now.

I think it has something to do with VS2005 and the application type because I was unable to run the version I compiled in VS2005 on the XP computer.

If I resolve the issue I will post the fix.

Thanks for all the help.

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.