Jump to content
The simFlight Network Forums

HOW TO WRITE "GREEN BACKGROUND MESSAGES" ON FS


Recommended Posts

i would use this code in C but i dont now how use the

FSUIPC_Write(DWORD dwOffset, DWORD dwSize, void *pSrce, DWORD *pdwResult);

how can i use the "void *pSrce"? Please someone gives me an example.....

regards

Mirko :D

Link to comment
Share on other sites

FSUIPC_Write(DWORD dwOffset, DWORD dwSize, void *pSrce, DWORD *pdwResult);

how can i use the "void *pSrce"?

It's the pointer to the data you want to write. It is defined as a "void pointer" so that you can use any data type -- a string pointer for a string of characters, or whatever.

Are you just learning C? Programming things to interface to FS is not a good starting project if you are just beginning.

Regards,

Pete

Link to comment
Share on other sites

Are you just learning C?

No, i'm not new to C but i've never saw a void pointer, only void methods!!!!.

Thank you for the answer!!!

Mirko

Just pull up your Kerninghan & Ritchie... should be in there. A void * is a pointer that could be made to point to ANY data type. Meaning the same variable coud be made to point to a character first (e.g. string), next to an int and even later to some struct containing data. But not simultaneously of course.

You probably shouldn't declare some variable as a void * unles you really don't know what's going to end up in it in the first place. It's a common way of transferring blocks of data of any type (e.g. "raw bits") from one place to another. Later in the code will be decided what data it actually is (or, if you're writing a dumb copy, for example, you don't want to care about the data type and output a void * as well).

The reason you see voids in front of a function a lot is because you don't want every function to return a value. In the case of a void function it will return a variable of no data type, e.g. no return value. You can make a function void * to let it return a raw memory address.

Just to let you know: Pointers are pretty messy, and don't fiddle with them too much or you'll cause defintite memory leaks or hard crashes. C doesn't have a way of checking whether an application stays within its own memory space (C++, however, does have a mechanism and raises an EAccessViolation if you 'step out of bounds'.)

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.