关于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编辑过]