如何解决尝试使用 4gl 从 Genero 写入 VIM
我想在 VI 终端中打开一个 .4gl 文件并写入它,这是我目前拥有的代码:
let p_command = "test -f ",MTGENDIR CLIPPED,"/",p_prog clipped,".4gl"
run p_command returning p_status
let p_command = "vi ",".4gl"
--let p_command = "w ",".4gl"
--let p_command = ":w ",".4gl"
run p_command
这是我在调试器中遇到的错误,一旦进入步骤 vi 然后它挂起:
(fgldb) next
376 let p_command = "vi ",".4gl"
(fgldb) next
377 run p_command
(fgldb) next
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal
如果我尝试使用上面的注释代码(w 或 :w)编写它会崩溃并显示此错误:
The DVM process crashed. Please contact FourJs support.
DVM has encountered a problem. Execution of 'mt_gen' stopped
还有其他方法可以写入 Genero 中的 .4gl 文件吗?
解决方法
回答最后一句话“我可以通过其他方式在 Genero 中写入 .4gl 文件吗?”然后你可以使用 base.Channel 类写入文件...
MAIN
DEFINE ch base.Channel
LET ch = base.Channel.create()
CALL ch.openFile("example.4gl","w")
CALL ch.writeLine("MAIN")
CALL ch.writeLine(" DISPLAY 'Hello World'")
CALL ch.writeLine("END MAIN")
CALL ch.close()
END MAIN
... 关键是使用 base.Channel.openFile 和 w(或 a)作为打开模式 http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_ClassChannel_openFile.html
或者,您可以在 STRING 或 base.StringBuffer 变量中构建文件并使用 TEXT writeFile 方法 http://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_datatypes_TEXT_writeFile.html ...
MAIN
DEFINE s STRING
DEFINE t TEXT
LET s =
"MAIN",ASCII(13)," DISPLAY 'Hello World'","END MAIN"
LOCATE t IN MEMORY
LET t = s
CALL t.writeFile("example2.4gl")
END MAIN
我不知道为什么您认为您的解决方案中需要 vi/vim 来写入 .4gl 文件。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。