Reputation: 1
I want to take user inputs in c language but I am unable to as the Sublime Text does not allow that. I want to create a build system for C that will take user inputs and display output in the default window and not use the terminal or terminus. Can someone help me with this ?
I tried different build systems but that would work only if I ran Simple print programs but it wouldn't run when I tried to take user input.
Upvotes: 0
Views: 49
Reputation: 11
Taking user inputs directly in Sublime Text's output window isn't supported by default because the output panel doesn't support interactive input.
However, since you want to avoid using those, you might consider an alternative approach.
You can create a new build system to prevent that:
{
"cmd": ["gcc", "-o", "$file_base_name", "$file_name"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"working_dir": "${file_path}",
"selector": "source.c",
"shell_cmd": "start cmd /c $file_base_name && pause"
}
Now, whenever you press Ctrl + B, Sublime Text will compile your code and open an external command prompt to execute it, allowing for user input.
Upvotes: 1