在使用字符串时为什么要先填充空格呢?

string ls_Path

unsignedlong lul_handle

ls_Path = space(1024)

lul_handle = Handle(GetApplication())

GetModuleFilenameW(lul_handle, ls_Path, 1024)// or GetModuleFilenameA if appropriate

因为没有初始化的地址,数据是任意的。为了方便,先填充空格。当然填充别的也可以,只是填充别的字符,再存入路径字符串,无法区分某个字符是你之前填充的,还是路径的一部分。