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 ...
随机推荐
- VS Code插件之Cordova Tools
原文:VS Code插件之Cordova Tools 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u011127019/article/detai ...
- Winform中GridView分组排序实现功能
由于客户最近要扩充公司的业务,之前基于Winform+web开发混合式的系统已经不能满足他们的需求,需要从新对系统进行分区处理. 考虑到系统模块里面用到的GridView视图比较多,我就结合了DevE ...
- 【18.40%】【codeforces 631D】Messenger
time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standa ...
- 【50.88%】【Codeforces round 382B】Urbanization
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- tap code —— 两个一位数字编码一个字母
5 * 5 的矩阵(表格)编码 26 个字母 单词中如果出现 K,就用 C 代替,所以其实也可视为表中无 K 这个字母(据说拉丁文中 K 都是用 C 来代替的): 在<疑犯追踪>(POI, ...
- 设置Oracle tnslsnr监听器口令
绿盟扫描提示引用程序脆弱账号 Oracle tnslsnr 监听器,加密主要为了防止监听被恶意远程关闭.关于这个安全问题的详细说明参见文字结尾转载的说明<Oracle的监听口令及监听器安全&g ...
- android游戏开发系列(1)——迅雷不及掩耳的声音
这种声音是短而快的声音,应该采用android.media.SoundPool实现. SoundPool的特点: 1. SoundPool载入音乐文件使用了独立的线程,不会阻塞UI主线程的操作.但是这 ...
- Attribute-based identification schemes for objects in internet of things
Methods and arrangements for object identification. An identification request is received from diffe ...
- tomcat中同时部署两个项目的问题
其中一个项目总是无法访问. 参考这两篇文章: 1. tomcat中同时部署两个项目的问题 2. java.lang.IllegalStateException: Web app root system ...
- C/S和B/S两种架构区别与优缺点分析
C/S和B/S,是再普通不过的两种软件架构方式,都可以进行同样的业务处理,甚至也可以用相同的方式实现共同的逻辑.既然如此,为何还要区分彼此呢?那我们就来看看二者的区别和联系. 一.C/S 架构 1. ...

