簡體   English   中英

嘗試使用 4gl 從 Genero 寫入 VIM

[英]Trying to write to VIM from Genero using 4gl

我想在VI終端中打開一個.4gl文件並寫入它,這是我目前的代碼:

 let p_command = "test -f ", MTGENDIR CLIPPED,"/",p_prog clipped,".4gl"
      run p_command returning p_status

      let p_command = "vi ",p_prog clipped,".4gl"
      --let p_command = "w ",p_prog clipped,".4gl"
      --let p_command = ":w ",p_prog clipped,".4gl"
      run p_command

這是我在調試器進入步驟 vi 后遇到的錯誤,然后它掛起:

(fgldb) next
376       let p_command = "vi ",p_prog clipped,".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 class 寫入文件...

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.ZFC35FDC70D52FC69D269883A8

MAIN 
    DEFINE s STRING
    DEFINE t TEXT

   LET s = 
      "MAIN", ASCII(13),
      "    DISPLAY 'Hello World'", ASCII(13),
      "END MAIN"

   LOCATE t IN MEMORY
   LET t = s
   CALL t.writeFile("example2.4gl")
END MAIN

我不確定為什么您認為您的解決方案中需要 vi/vim 才能寫入 a.4gl 文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM