Delphi各种从文件里读取内容的方法
|
Hi I am having a problem running a function to read a text file the problem seems to be that my antivirus blocks my delphi console program because when I do for a visual form there is no problem . Tengos two codes one is this :
This goes to perfection but do not want to use the component Classes for the program does not weigh much . Also I have this :
Other code.
This is the problem because when I use my antivirus deletes it at the time , my question to other alternatives I have to read a text file without using Classes. Someone can help me? |
|||||||||||||||||||||
|
|
You can use win32 api. In one of my apps I do things like that, extend/modify to match your needs. This only use Win32 API and does not lock the file. It's like notepad. When you open a file with notepad it is not locked and can still be written or read by other software.
|
|||||||||||||||||||||
|


|
||||
|
This code works fine for me as a console application, Delphi 2007, running on Win7 64: Contents of 'E:\TempFiles\Test.txt':
Source:
Produces output:
|
|||||||||||||||||||||
|
|
If you don't want to use the Classes unit, only need to operate on this file, and are making a Windows executable, you could use the Windows unit instead and call the Win32 API functions: CreateFile, ReadFile, CloseHandle and related functions. |
https://stackoverflow.com/questions/19983202/read-text-files-in-delphi
Delphi各种从文件里读取内容的方法的更多相关文章
- delphi xe4 ini文件不能读取的解决方法
今天发现用inifiles下 tinifile.readstring方法突然不能读数据了,结果把ini文件格式由utf-8改成unicode后就能正常读取了.
- Flex读取txt文件里的内容(二)
Flex读取txt文件里的内容 自己主动生成的文件 LoadTxt-app.xml: <?xml version="1.0" encoding="utf-8&quo ...
- Flex读取txt文件里的内容(一)
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/you23hai45/article/details/25248307 Flex读取txt文件里的内 ...
- Flex读取txt文件里的内容报错
Flex读取txt文件里的内容 1.详细错误例如以下 2.错误原因 读取文件不存在 var file:File = new File(File.applicationDirectory.nativeP ...
- 从Excel文件中读取内容
从Excel文件中读取内容 global::System.Web.HttpPostedFileBase file = Request.Files["txtFile"]; strin ...
- element ui 上传文件,读取内容乱码解决
element ui 上传文件,读取内容乱码解决: 加第二个参数 reader.readAsText(file.raw,'gb2312'); <el-upload class="upl ...
- web打开本地文件并读取内容
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- php mysqli query 查询数据库后读取内容的方法
php mysqli query 查询数据库后读取内容的方法 <?php$mysqli = new mysqli("localhost", "my_user&quo ...
- Jupyter notebook导入Pycharm项目的.py文件里的模块及方法
Jupyter notebook导入Pycharm项目种的.py文件里的模块及方法 需要在Jupyter notebook里调用自己写的代码,过程如下. 首先在Pycharm里写好一个文件,例如DCC ...
随机推荐
- C# powshell 调用
原文:C# powshell 调用 本文告诉大家如何在 ps 脚本使用 C# 代码. 首先创建一个 C# 的控制台项目,注意修改输出为类库. 现在的 Powershell 还不支持 dotnet co ...
- gdal库集成MrSID库的做法
作者:朱金灿 来源:http://blog.csdn.net/clever101 首先从Lizardtech网站:http://www.lizardtech.com/download/develope ...
- Asp.net C# 获取本周上周本月上月本年上年第一天最后一天时间大全
DateTime dt = DateTime.Now; int weeknow = Convert.ToInt32(DateTime.Now.DayOfWeek); ) * weeknow + ; D ...
- Qt5.9 官方发布的新版本亮点的确不胜枚举(而且修复2000+ bugs)
作者:Summer Fang链接:https://www.zhihu.com/question/60486611/answer/177584284来源:知乎著作权归作者所有.商业转载请联系作者获得授权 ...
- go 工具链目前[不支持编译 windows 下的动态链接库][1],不过[支持静态链接库][2]
go 工具链目前[不支持编译 windows 下的动态链接库][1],不过[支持静态链接库][2].想要产生dll,可以这样 workaround ,参考 golang [issuse#11058][ ...
- 分享 WebBrowser显示Html内容3点细节技巧,解决刷新后空白
直接显示Html内容,不像直接导航网址容易处理: 问题:按微软的控件属性提示,可以用WebBrowser.DocumentText 属性赋值 ,但是这种赋值,只是首次有效,后续切换都没啥作用. 下面给 ...
- ubuntu 12.04 简单配置samba服务,实现主机与虚拟机互通(设置Windows虚拟盘)
环境: virtualbox ubuntu12.04 首先,如果你到这步了,说明你的window与linux的网络已经配好了,他们之间是可以互相Ping通的,如果没有,请看我以前的文章 由于我linu ...
- Android获取百度音乐下载音乐和歌词下载链接
首先,你必须通过以下连接下载歌曲: http://box.zhangmen.baidu.com/x?op=12&count=1&title={title}$${author}$$$$ ...
- PYC文件简介
PYC文件简介¶ 不说废话,这里说的pyc文件就是 Python 程序编译后得到的字节码文件 (py->pyc). 基本格式¶ pyc文件一般由3个部分组成: 最开始4个字节是一个Maigc i ...
- WPF中使用cefsharp
原文:WPF中使用cefsharp 新入职一家公司,由写服务端接口变成了软硬件通信.服务器.客户端.C/S.B/S乱七八糟各种打杂.首先接收一个WPF项目,因为不熟WPF,再加上前端我也不熟,我打算使 ...

