崇高的文本推出单独的命令窗口(C / C ++) [英] sublime text launch separate command window (c / c++)

查看:126
本文介绍了崇高的文本推出单独的命令窗口(C / C ++)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做所有的方案,在C程序设计由Stephen G.科昌,作为一个练习,并与一些更精细的细节,以自己熟悉(我没去学校计算机科学)的C

(我是Windows 8的计算机上)

很多的书很简单的程序,我想输入与崇高的文本程序(而不是code ::块,我一直在使用与其中了openFrameworks)。有没有一种简单的方法来启动一个单独的命令窗口的程序被编译之后。

这是一种哈克,但我改变了构建的运行版本推出编译的程序

 CMD:$ {} file_base_name .EXE]

但显然崇高的文本文档中说,GUI的是燮pressed?

<一个href=\"https://sublime-text-unofficial-documentation.readthedocs.org/en/latest/reference/build_systems.html\" rel=\"nofollow\">https://sublime-text-unofficial-documentation.readthedocs.org/en/latest/reference/build_systems.html

我想要做的是推出一个单独的命令提示符窗口。主要的原因是,scanf函数不会暂停输入。让我知道如果周围有一个快速的工作:


  • 某些变通方法崇高文本(设置我不知道的)

  • 如何更改构建文件启动一个实际窗口

  • 某种方式在C轻松启动一个单独的窗口


解决方案

  {
    CMD:开始,CMD,/ C $ file_base_name.exe],
    选择:的text.c
    壳:真
}

在CMD 启动命令打开传递给它的命令的一个新窗口。结果
请注意,以保持窗口从你的程序的最后收盘马上,你就必须结束他们系统(暂停); 残培();用/ K ,或更换/ C,以保持CMD了

编辑:经过并调试:

 CMD:开始,CMD,/ C,$ file_base_name.exe&安培;暂停]

我曾与Java同样的问题,试图建立一个运行变异,并最终推出了这一点:

 变种:
[
    {
        CMD:开始,CMD,/ C,java的$ file_base_name&安培;暂停]
        名:运行
    }
]

I am trying to do all the programs in "Programming in C" by Stephen G. Kochan, as an exercise and to familiarize myself with some of the finer details (I didn't go to school for computer science) of C.

(I am on a Windows 8 machine)

A lot of the book is simple programs and I'd like to enter the programs with sublime text (as opposed to code::blocks, which I have been using with openFrameworks). Is there an easy way to launch a separate command window for a program after it is compiled.

It's kind of hacky, but I changed the "run" version of build to launch the compiled program

"cmd": ["${file_base_name}.exe"]

but apparently the Sublime Text documentation says that "GUI's are suppressed" ?

https://sublime-text-unofficial-documentation.readthedocs.org/en/latest/reference/build_systems.html

What I want to do is launch a separate command prompt window. The primary reason is that "scanf" does not halt for input. Let me know if there is a quick work around:

  • some workaround in Sublime Text ( a setting I'm not aware of)
  • how to change the build file to launch an actual window
  • some way to easily launch a separate window in C

解决方案

{
    "cmd": ["start", "cmd", "/c $file_base_name.exe"],
    "selector": "text.c",
    "shell": "true"
}

The cmd start command opens a new window of the command passed to it.
Note that to keep the window from closing immediately at the end of your programs, you'll have end them with system("pause"); or getch();, or replace /c with /k to keep cmd up.

EDIT: after more digging and debugging:

"cmd": ["start", "cmd", "/c", "$file_base_name.exe & pause"]  

I had the same issue with Java, trying to create a Run Variant, and eventually came out with this:

"variants":
[
    {
        "cmd": ["start", "cmd", "/c", "java $file_base_name & pause"],
        "name": "Run"
    }
]

这篇关于崇高的文本推出单独的命令窗口(C / C ++)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆