当然可以!!!!
HTM\HTML\ASP其实都是文本文件, 你将这些文件扩展名改为TXT看看?
HTM\HTML\ASP其实都是文本文件, 你将这些文件扩展名改为TXT看看?
解决方案 »
- vb6 滚动条VScroll控件,控制超过-32768~+32768行数据呢?
- 推荐一款可打连续纸的激光打印机
- 为什么textbox 文本框不能显示小数点前面的0
- 想了解VB如何使用SQL的?
- 为什么有时侯会显示同一个内容?
- picturebox 中的Width与Height属性怎么以像素方式赋值?(在线等待)
- vb语句 函数定义问题
- 如何去掉窗体上的图标,最小化最大化按钮存在
- 呵呵!! CSDN 茶馆 再次开张!!!!(东北分店)欢迎光临
- 请问怎样在用户将form托动到top为负数时立即反应?一定要用timer吗?有别额办法?解决后加分
- VB中,我怎样控制我的程序只能有一个实例运行?????
- 二进制转换成十进制
OK,那么对文本文件如何读写操作?请给出代码例子?我没有这方面的经验,手头可参考的资料几乎没有。拜托!
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As LongPublic Sub ReplaceText(sFile As String, ReplaceWith As String, ReplaceTo As String)
Dim inFile As Integer
Dim outPath As String
Dim outName As String
Dim outFile As String
Dim strLen As Integer
Dim one_Line As String
inFile = FreeFile
Open sFile For Input Access Read As #inFile '打开输入文件
outPath = Space$(340)
strLen = GetTempPath(340, outPath)
If strLen <> 0 Then
outPath = Left$(outPath, strLen)
outName = Space$(340)
If GetTempFileName(outPath, "tmp", 0, outName) <> 0 Then
strLen = InStr(outName, vbNullChar) - 1
If strLen > 0 Then
outName = Left$(outName, strLen)
outFile = FreeFile
Open outName For Output Access Write As outFile
Do While Not EOF(inFile)
Line Input #inFile, one_Line
Print #outFile, Replace(one_Line, ReplaceWith, ReplaceTo)
Loop
Close #outFile
Close #inFile
Kill sFile
Name outName As sFile
End If
End If
End If
End Sub
textbox中,然后查找特定字符串,在其后面插入任意字符串,并且在textbox中及时更新,就是说在textbox中显示更新后的文件内容,最后将文件保存。
你老不要敝气啊!不过我都快不行了024h(一人)
有没有发现可以直接用记录本来编辑asp或html文件,且可以保存修改结果?
icevi(按钮工厂)的意思就是把asp当作Text文件来处理,而只不过这个txt文件的扩展名是.asp而已
例如:
dim fs as new filesystemobject
dim a as textstream //定义文本文件流
set a=fs.opentextfile(filename,forreading,false)
//打开文本文件,不管他是Html or Asp文件
textbox.txt=a.readall //读全部到textbox
a.close //关闭文本流抱歉,用Delphi习惯了,在语法上可能有误.