load a lua file in cpp, then try executeString with the output buffer, and it will get lua error in win32 platform

Hi all,
I try to load a lua file into memory (use CCFileData data(path.c_str(), “rb”) to load it), and run it with executeString((char*)data.getBuffer()).
the above logic run successful in IOS platform, but when it come to WIN32, it will cause [lua error] binary string: unexpected end in precompiled chunk.(binary lua file) or unexpected symbol near ‘? (normal lua file)
“unexpected symbol near’?”,i had analysed this error, the reason is the buffer data not end with ‘’, but ‘?’.
so, how to solved these error? I have been crazy for these errors for several days. any advice will be grate helpful, thanks.