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 ...
随机推荐
- 苹果抛弃的芯片公司Imagination被中资49亿溢价收购
原标题:中国资本Canyon Bridge出资5.5亿英镑收购Imagination芯片 来源:观察者网 对于一家手机硬件公司来说,被苹果看上可谓是“一夜之间,鸡犬升天”.但是如果被苹果抛弃了呢?那可 ...
- 在Windows中安装MinGW-w64(有图,一步一步)
在Windows中安装MinGW-w64 发表回复 如需配合Sublime Text 3编译C程序, 请参考本站文章: 使用Sublime Text 3与MinGW-w64编译C语言程序 MinGW, ...
- 一个2013届毕业生(踏上IT行业)的迷茫(3)
高中,是校园题材中出现最多的角色,但我的高中缺非常灰淡.我上的高中在我们镇上,记得在上小学的时候我哥在高中,我每次从学校门口过的时候都感觉高中好大,门口好漂亮,但是我从来都没敢进去.就在2006年我以 ...
- Redis 宝典 | 基础、高级特性与性能调优
转载:Redis 宝典 | 基础.高级特性与性能调优 本文由 DevOpsDays 本文由简书作者kelgon供稿,高效运维社区致力于陪伴您的职业生涯,与您一起愉快的成长. 作者:kelgon ...
- APP和服务端-架构设计(二)
1. App架构设计经验谈:接口的设计 App与服务器的通信接口如何设计得好,需要考虑的地方挺多的,在此根据我的一些经验做一些总结分享,旨在抛砖引玉. 1.1 安全机制的设计 现在,大部分App的接口 ...
- Microsoft IoT Starter Kit
Microsoft IoT Starter Kit 开发初体验 1. 引子 今年6月底,在上海举办的中国国际物联网大会上,微软中国面向中国物联网社区推出了Microsoft IoT Starter K ...
- Linux性能测试 pmap命令
名称: pmap - report memory map of a process(查看进程的内存映像信息)用法 pmap [ -x | -d ] [ -q ] pids... ...
- WPF loading加载动画库
原文:WPF loading加载动画库 1. 下载Dll https://pan.baidu.com/s/1wKgv5_Q8phWo5CrXWlB9dA 2.在项目中添加引用 ...
- WPF中StringFormat的用法
原文:WPF中StringFormat的用法 WPF中StringFormat的用法可以参照C#中string.Format的用法 1. C#中用法: 格式化货币(跟系统的环境有关,中文系统默认格式化 ...
- WPF - 模板查看工具:Show Me The Template及如何查看第三方主题
原文:WPF - 模板查看工具:Show Me The Template及如何查看第三方主题 在学习WPF的模板(DataTemplate.ItemsPanelTemplate.ControlTemp ...

