Running Code in Sublime text 2 ( Mac OS X )

后端 未结 1 725
执念已碎
执念已碎 2020-11-27 08:15

I\'m trying to run C code in sublime text 2 and i\'ve noticed that scanf seems to be completely ignored, although it works fine in both xcode and in the terminal with gcc. I

相关标签:
1条回答
  • 2020-11-27 09:02

    This has been discussed in several questions on SO, and the unofficial docs are currently being updated to more clearly state this: neither ST2 nor ST3 supports direct input to programs running within build systems inside Sublime Text: C/C++'s scanf and colleagues do not work, nor do Python's raw_input (Python 2) or input (Python 3), Ruby's gets, Java's Scanner class, etc. This is a fundamental limitation of the program.

    However, it can be worked around in two ways. First, you can run your build system in a terminal. Second, if you are using an interpreted language like JavaScript, Python, Ruby, Perl, Scheme and all the associated Lisp-like languages like Clojure, Erlang, Haskell, PHP, R, etc., you can check out the excellent SublimeREPL plugin. You can open a REPL for interactive programming, and send programs (or bits of them) to it and interact with them just as on the command line. Documentation is here.

    0 讨论(0)
提交回复
热议问题