简体   繁体   中英

Dll Plug-in basic questions

For the last couple of days i've been learning C++ to make a dll plug-in for a program.

My objective is to get data(the Flight Plan's to be more precise) from the program and on a first phase save them to a text file(second phase will be connect them with python but for now it's just that). So in my header file i imported a file with many classes and many functions(which is given by the plugin development guide). The class i'm interested in is the class CAircraftFlightPlan and it has some functions inside like this:

bool IsReceived(void) const;
//-----------------------------------------------------------------
//  Return :
//      true    - if any kind of FL is received from the servers
//      false   - else
//-----------------------------------------------------------------

const char * GetOrigin ( void ) const ;
//-----------------------------------------------------------------
//  Return :
//      The origin airport.
//-----------------------------------------------------------------


int     GetFinalAltitude ( void ) const ;
//-----------------------------------------------------------------
//  Return :
//      The final requested altitude.
//-----------------------------------------------------------------

I have many doubts about this, hope you can help:

1-what does it mean having "nameoffuction"(void) const? It receives nothing?how do i call these functions then

2-i do not understand this function "const char * GetOrigin ( void ) const ;",what does it want, a const or a char?

3-The comments below the functions tell that they return this or that. But how do they return that if the function is empty, it's just "int GetFinalAltitude(void) const"...

4-In the source file, i try to call one of the functions to write it to a txt file,how can i do this:

int airplane;
ofstream textfile;
textfile.open("FP.txt");
textfile<<int GetTrueAirspeed("MAH545"); //i know there's an error here, how do i solve it?
textfile.close();

I'm very sorry for asking these (noob i suppose) questions but they are way to specific to search for an answer online(i tried already)

Thank you for the help

  1. Yes, it takes no arguments so you call it like so: nameoffunction()

  2. This also takes no arguments so it is called as GetOrigin() . It returns a pointer to a const char .

  3. As above, the functions take no arguments but do return values.

  4. Delete the int in front of the function call. This should get rid of at least one error.

    textfile<< GetTrueAirspeed("MAH545");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM