如何从文本文件中读取数据 [英] How do I read data from text file

查看:172
本文介绍了如何从文本文件中读取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个复制/移动文件的应用程序



我想为它添加脚本功能。对于exaple,文本文件包含以下内容:



movefile =C:\ Pic1.jpg,C:\ Windows \Pic1.jpg



应用程序将读取以下文件并将pic1.jpg复制到C:\windows文件夹。但我是一个新手,我在许多论坛上搜索,但我找不到答案。请帮忙。



我的尝试:



my.computer .filesystem.movefile(C:\ Pic1.jpg,C:\ Windows \ pic1.hpg)

i'm developing a applicatin to copy/move files

i want to add script functionality to it. for exaple, a text files contains the following:

movefile = "C:\Pic1.jpg, C:\Windows\Pic1.jpg"

the application will read the follwoing file and copy the pic1.jpg to "C:\windows" folder. but i'm a newbie and i searched on many forums but i can't find the answer. please help.

What I have tried:

my.computer.filesystem.movefile("C:\Pic1.jpg, C:\Windows\pic1.hpg")

推荐答案

Quote:

想要为其添加脚本功能。

want to add script functionality to it.

您可以使用实际的脚本编程语言。例如,您可以使用VBScript。例如,请参阅 VB.NET Windows窗体中的VBScript - VB.NET | Dream.In.Code [ ^ ]

You could use an actual script programming language. For instance you could use VBScript. See, for instance VBScript In VB.NET Windows Form - VB.NET | Dream.In.Code[^]


使用 StreamReader类(System.IO) [ ^ ]这将允许您读取每一行。然后,您可以使用 String.Split方法(系统) [ ^ ]获取该行的单独部分。
Use the StreamReader Class (System.IO)[^] which will allow you to read each line. You can then use the String.Split Method (System)[^] to get the separate parts of the line.


这篇关于如何从文本文件中读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆