刚改了下用户函数 File.au3, 把_ReplaceStringInFile 函数中的打开文件模式用由 $FO_OVERWRITE改为 3mil ...
lulubobo27 发表于 2011-5-14 17:28
#include <winapi.au3>
$filename = "out.txt"
$CODE = _GetFileCode($filename)
MsgBox(0, 0, $CODE)
Func _GetFileCode($file)
Local $nBytes
$tBuffer = DllStructCreate("byte[" & 2 & "]")
$hFile = _WinAPI_CreateFile($file, 2, 2)
_WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 2, $nBytes)
_WinAPI_CloseHandle($hFile)
$sText = DllStructGetData($tBuffer, 1)
Switch $sText
Case "0xEFBB"
Return "UTF-8"
Case "0XFEFF"
Return "Unicode big endian"
Case "0XFEFE"
Return "Unicode"
Case Else
Return "ANSI"
EndSwitch
EndFunc ;==>_GetFileCode
|