标题:关于Fwrite()的问题
取消只看楼主
pjtyzyq
Rank: 4
等 级:业余侠客
威 望:6
帖 子:230
专家分:240
注 册:2016-2-14
结帖率:100%
已结贴  问题点数:20 回复次数:1 
关于Fwrite()的问题
这是VFP帮助里的例子,加了一行“FWRITE(gnFileHandle, "abcd" )”,希望将字符串“abcd”写入文件,却没有成功,问题出在哪?
Local gnFileHandle,nSize,cString
gnFileHandle = FOPEN("D:\kejian\file_s\sd.txt")
* Seek to end of file to determine number of bytes in the file.
nSize =  FSEEK(gnFileHandle, 0, 2)     && 移动指针到末尾
IF nSize <= 0
 * If file is empty, display an error message.
 WAIT WINDOW "This file is empty!" NOWAIT
ELSE
 * If file is not empty, store the file's contents in memory
 * and display the text in the main Visual FoxPro window.
 = FSEEK(gnFileHandle, 0, 0)      && 移动指针到开始
 cString = FREAD(gnFileHandle, nSize)
  =FWRITE(gnFileHandle, "abcd" )
ENDIF
= FCLOSE(gnFileHandle)         && 关闭文件

[此贴子已经被作者于2021-4-28 20:24编辑过]

搜索更多相关主题的帖子: IF 指针 Fwrite the file 
2021-04-28 20:22
pjtyzyq
Rank: 4
等 级:业余侠客
威 望:6
帖 子:230
专家分:240
注 册:2016-2-14
得分:0 
回复 2楼 sdta
谢谢!
2021-04-28 20:55



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-505607-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.570424 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved