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 parameterCodePudding user response:
How to configure, solvingCodePudding user response:
Declaring a global variable gs_file_nameProgram 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 pathD_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 tryCodePudding user response:
The upstairs right upstairsCodePudding user response:
May be your operation on the path, which changed the default pathCodePudding 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 nodeD_top=profilestring (ls_filepath, table_name, 'top', ')//top margin
CodePudding user response:
Don't use relative pathCould 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_nameStatement 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_nameProgram 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