【发布时间】:2016-12-09 10:47:28
【问题描述】:
要检查数据库 (SQL Anywhere) 何时启动并准备好接收请求,我将数据库消息窗口输出到日志(文本)文件,然后尝试使用 LoadStringFromFile 读取它,然后我使用Pos 搜索特定文本。问题是这会失败(我假设),因为文件正在使用中。
Exec(strInstallPath + '\Bin32\dbeng17.exe', '-n ' + strEngineName + ' "' + strInstallPath + '\Database\Olympus.db" -n ' + strDatabaseName + ' -gdall -xtcpip -ti0 -c25p -ot "' + strTempPath + '\dbeng.log"', '', SW_HIDE,
ewNoWait, intResultCode);
if not LoadStringFromFile(strTempPath + '\dbeng.log', astrDatabaseEngineLog) then
begin
Log('Loading string from file failed.');
end;
我也尝试使用FileCopy 复制日志文件并尝试从文件副本中读取,但FileCopy 也失败了。
if not FileCopy(strTempPath + '\dbeng.log', strTempPath + '\dbengcopy.log', False) then
begin
Log('File copy failed.');
end;
有什么方法可以从正在使用的文件中读取数据或其他方法吗?
【问题讨论】:
标签: inno-setup sqlanywhere pascalscript