Home > database >  PB reading configuration files
PB reading configuration files

Time:10-26

D_top=profilestring (' print. Ini, table_name, 'top', ')//is apart from the above
D_bottom=profilestring (' print. Ini, table_name, 'bottom', ')//bottom margin
D_left=profilestring (' print. Ini, table_name, 'left', ')//the left margin
D_right=profilestring (' print. Ini, table_name, 'right', ')//right margin
D_orientation=profilestring (' print. Ini, table_name, 'orientation', ')//horizontal vertical print
So I read the first time can read configuration files' print. Ini 'corresponding value can be read, but the second execution can't read the associated configuration information, is null, only after program closed, reopen the good will, I think is a path problem, consult a great god can solve?

CodePudding user response:

Profilestring configured physical path to the first parameter

CodePudding user response:

How to configure, solving

CodePudding user response:

Declaring a global variable gs_file_name
Program start running the open command invokes the GetCurrentDirectory ()
Get the current directory, immediately assigned to global variables, and then
D_top=profilestring ( gs_file_name + '\' + 'print. Ini', table_name, 'top', ')//top margin

CodePudding user response:

To try the following code, if the use is the question about which path
D_top=profilestring (' c: \ print. Ini, table_name, 'top', ')//is apart from the above
D_bottom=profilestring (' c: \ print. Ini, table_name, 'bottom', ')//bottom margin
D_left=profilestring (' c: \ print. Ini, table_name, 'left', ')//the left margin
D_right=profilestring (' c: \ print. Ini, table_name, 'right', ')//right margin
D_orientation=profilestring (' c: \ print. Ini, table_name, 'orientation', ')//horizontal longitudinal printing

CodePudding user response:

The third floor also can have a try

CodePudding user response:

The upstairs right upstairs

CodePudding user response:

May be your operation on the path, which changed the default path

CodePudding user response:

Each time before you read the configuration file specifies the configuration file location and ls_filepath assigned to variables, and then through the profilestring read the value of the node
D_top=profilestring (ls_filepath, table_name, 'top', ')//top margin

CodePudding user response:

Don't use relative path
Could the program path in the application opens to
Then
D_top=profilestring (gs_AppPath + '\ print ini', table_name, 'top', ')//top margin

CodePudding user response:

Declaring a global variable gs_path, gs_file_name
Statement API GetCurrentDirectory ()

In a program began to run in the open command calls gs_path=GetCurrentDirectory ()
Get the current directory, immediately assigned to global variable gs_file_name=gs_path + 'print. Ini', then the
D_top=profilestring (gs_file_name, 'table_name,' top ', ' ')//top margin

CodePudding user response:

The original poster in print or other operation changed the system default directory, the default directory of the program is its own root directory, once the change is can't find the corresponding files, if often change directory, then adopt the way of 4th floor declared a global variable gs_file_name
Program start running the open command invokes the GetCurrentDirectory ()
Get the current directory, immediately assigned to global variables, and then
D_top=profilestring (gs_file_name + '\' + 'print. Ini', table_name, 'top', ')//top margin
  • Related