| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY 
共有 262 人关注过本帖
标题:[求助]请教高手,我的写文件程序哪里有错误。
收藏  订阅  推荐  打印 
woxiangyao
Rank: 1
等级:新手上路
帖子:5
积分:150
注册:2005-4-2
[求助]请教高手,我的写文件程序哪里有错误。

我运行了下面的代码后,复制后的图像特别模糊,请问这是怎么回事
如果我复制的是文本文件,复制后的文本文件里面有乱码。
请高手帮我查查哪里错了。谢谢。
Dim FreeF As Integer
Dim LenFile As Long
Dim nCnt As Long
Dim LocData As String
FreeF = FreeFile
Open "f:\desktop.bmp" For Binary As #99
Open "f:\1.bmp" For Binary As #1
nCnt = 1
LenFile = LOF(99)
Do Until nCnt > (LenFile)
LocData = Space$(4096)
  Get #99, nCnt, LocData
   If nCnt + 4096 > LenFile Then
     Put #1,ncnt , Mid$(LocData, 1, (LenFile - nCnt) )
   Else
   Put #1, nCnt, LocData
  End If
   nCnt = nCnt + 4096
Loop
Close #99
Close #1我运行了下面的代码后,复制后的图像特别模糊,请问这是怎么回事
如果我复制的是文本文件,复制后的文本文件里面有乱码。
请高手帮我查查哪里错了。谢谢。
Dim FreeF As Integer
Dim LenFile As Long
Dim nCnt As Long
Dim LocData As String
FreeF = FreeFile
Open "f:\desktop.bmp" For Binary As #99
Open "f:\1.bmp" For Binary As #1
nCnt = 1
LenFile = LOF(99)
Do Until nCnt > (LenFile)
LocData = Space$(4096)
  Get #99, nCnt, LocData
   If nCnt + 4096 > LenFile Then
     Put #1,ncnt , Mid$(LocData, 1, (LenFile - nCnt) )
   Else
   Put #1, nCnt, LocData
  End If
   nCnt = nCnt + 4096
Loop
Close #99
Close #1我运行了下面的代码后,复制后的图像特别模糊,请问这是怎么回事
如果我复制的是文本文件,复制后的文本文件里面有乱码。
请高手帮我查查哪里错了。谢谢。
Dim FreeF As Integer
Dim LenFile As Long
Dim nCnt As Long
Dim LocData As String
FreeF = FreeFile
Open "f:\desktop.bmp" For Binary As #99
Open "f:\1.bmp" For Binary As #1
nCnt = 1
LenFile = LOF(99)
Do Until nCnt > (LenFile)
LocData = Space$(4096)
  Get #99, nCnt, LocData
   If nCnt + 4096 > LenFile Then
     Put #1,ncnt , Mid$(LocData, 1, (LenFile - nCnt) )
   Else
   Put #1, nCnt, LocData
  End If
   nCnt = nCnt + 4096
Loop
Close #99
Close #1
搜索更多相关主题的帖子: nCnt  文件  Dim  LenFile  
2005-4-18 23:11
serverliu
Rank: 1
等级:新手上路
帖子:24
积分:340
注册:2005-2-10

为什么要复制了
直接用filecopy  就可以了
2005-4-19 08:26
griefforyou
Rank: 12Rank: 12Rank: 12
等级:贵宾
威望:27
帖子:3338
积分:33882
注册:2004-4-15

问题在此,LocData = Space$(4096)
你读的是二进制数据,却用的是字符串暂存,字符串遇到0表示终止,你应该使用Byte数组。

四月天原创文学网 http://yc.4yt.net
2005-4-19 08:37
woxiangyao
Rank: 1
等级:新手上路
帖子:5
积分:150
注册:2005-4-2

谢谢版主了,我试试
2005-4-21 00:34
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.066310 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved