1. 程式人生 > >VB 讀取INI檔案

VB 讀取INI檔案

R = GetPrivateProfileString("IMP", "IMP_PATH", "", sImpPath, Len(sImpPath), App.Path & "\Param.ini")

    g_imp_path = Trim(Left(sImpPath, R))

讀取Ini 檔案時候,如果引數中有中文,讀取的值後面有很多空格

如:

param.ini:

[IMP]
IMP_PATH=D:\ProjectManager\20160912_海關單一視窗\program\ImpAndExpForCust\in

讀取到的值:

'imp
    R = GetPrivateProfileString("IMP", "IMP_PATH", "", sImpPath, Len(sImpPath), App.Path & "\Param.ini")
    g_imp_path = Trim(Left(sImpPath, R))

g_imp_path =D:\ProjectManager\20160912_海關單一視窗\program\ImpAndExpForCust\in

後面的空格,用trim都無法去掉