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 ...
随机推荐
- python列表分页
列表分页 上章的结束,若在实际开发过程中,会发现一个问题,那就首页或关注分享,是一下子按时间顺序全部显示出来,这在实际项目中不可能出现的,想想实际中的产品是如何做的? 一般来说,无非是两种,一种是 ...
- Sublime Text3中JSX支持Emmet快捷键
在复习React的过程中,发现Sublime有些快捷键不能用了,如Emmet的Tab快速生成HTML代码只能用Ctrl+E快捷键,而不能用Tab键了,在网上找了很多文章,发现都有问题,最终自己通过下面 ...
- 人生不过一个字【Life is but a word】
有人说,人生是一出悲悲喜喜的戏,是一首飘飘忽忽的歌,是一次上去又下来的登山运动,是一场明明灭灭的烟花……是的,有道理,但听起来,太玄虚:悟起来,太深远:做起来,太复杂. 我说 ...
- 加减密 DES
/**//// <summary> /// DES /// </summary> public class DES_ { private DES mydes; public s ...
- python 读写XLS
需要库: xlrd, xlwt, xlutils 导入 import xlrd from xlutils.copy import copy 打开文件 data = xlrd.open_workbook ...
- MyEclipse迅速
MyEclipse迅速 1.详细例如以下图 2.提示原因 3.解决方案 版权声明:本文博主原创文章.博客,未经同意不得转载.
- 【原】对MYSQL下视图的一些总结
注:本文使用mysql5.5版本为例. 做过数据库开发的同学,对视图(VIEW)应该不会陌生. 我接触视图最多的应用场景有两个: 1)出于权限问题,为了限制访问者看到过多的表字段(或内容),就 ...
- Win10忘记ubuntu子系统密码
原文:Win10忘记ubuntu子系统密码 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/wf19930209/article/details/80 ...
- 倒计时的CountDownTimer
直接看这里吧,我仅仅是搬运工. 定时运行在一段时候后停止的倒计时,在倒计时运行过程中会在固定间隔时间得到通知(译者:触发onTick方法),以下的样例显示在一个文本框中显示一个30s倒计时: , 1 ...
- OpenGL(二十二) gluBuild2DMipmaps 加载Mip纹理贴图
当纹理被用于渲染一个面积比它本身小很多的对象时,会由于纹理图像的降采样率不足而导致混叠现象,主要的表现特征是纹理图像的闪烁,出现纹理躁动.特别是在场景远近移动变换时,这种闪烁情况更为明显,严重可能会影 ...

