n4gix
Resource contributor
- Messages
- 11,674
- Country

This doesn't seem like it should be that difficult, but it's not working... 
I've used GetPrivateProfileString(); successfully to read my own .ini type files, as well as WritePrivateProfileString(); to record updated variables, so I'm quite familiar with the process.
I currently have a generic blackbox gauge that will create a custom folder if one does not exist, and create/save a custom file based on the 5th parameter in the panel.cfg entry.
If no 5th parameter exists, it will default to writing the file in the currently selected a/c folder:
char total_name[100] = "./blackbox.dat\0";
IOW, one folder UP from the \panel folder.
Okay, so much for what DOES WORK correctly, without fail, everytime!
Here's the current problem. I wish to 'read' the current values stored in the station_load.n entries of the aircraft.cfg file. This then should work:
CHAR totalpathname[MAX_PATH] = "./aircraft.cfg\0";
Alas, it does not...
...even specifying the complete path\filename doesn't work...
All I get for all this bother is the darn default failure message I've provided:
Failed to Find File
Any ideas? <humbly holding hat in hand>
I've used GetPrivateProfileString(); successfully to read my own .ini type files, as well as WritePrivateProfileString(); to record updated variables, so I'm quite familiar with the process.
I currently have a generic blackbox gauge that will create a custom folder if one does not exist, and create/save a custom file based on the 5th parameter in the panel.cfg entry.
If no 5th parameter exists, it will default to writing the file in the currently selected a/c folder:
char total_name[100] = "./blackbox.dat\0";
IOW, one folder UP from the \panel folder.
Okay, so much for what DOES WORK correctly, without fail, everytime!
Here's the current problem. I wish to 'read' the current values stored in the station_load.n entries of the aircraft.cfg file. This then should work:
CHAR totalpathname[MAX_PATH] = "./aircraft.cfg\0";
Alas, it does not...
...even specifying the complete path\filename doesn't work...
Code:
CHAR totalpathname[MAX_PATH] = "D:\FS9\Aircraft\Eaglesoft Liberty XL2/aircraft.cfg\0";
CHAR chStation_load0[MAX_PATH] = "";
CHAR chStation_load1[MAX_PATH] = "";
CHAR chStation_load2[MAX_PATH] = "";
CHAR chFailure[MAX_PATH] = "Failed to Find File\0";
//---------------------------
case PANEL_SERVICE_POST_INSTALL:
GetPrivateProfileString("WEIGHT_AND_BALANCE", "station_load.0", chFailure, chStation_load0, 100, totalpathname);
GetPrivateProfileString("WEIGHT_AND_BALANCE", "station_load.1", chFailure, chStation_load1, 100, totalpathname);
GetPrivateProfileString("WEIGHT_AND_BALANCE", "station_load.2", chFailure, chStation_load2, 100, totalpathname);
break;
//----------------------------
FLOAT64 FSAPI callback2( PELEMENT_STRING pelement)
{
float rwert=pelement->source_var[0].var_value.n;
rwert = (float)station1 ;
sprintf(pelement->string,"%s",chStation_load0);
return 0;
}
etc.
All I get for all this bother is the darn default failure message I've provided:
Failed to Find File
Any ideas? <humbly holding hat in hand>




