Redirect programs directly to eclipse console - c

I am using eclipse cdt oxygen with mingw64 7.2.0 on windows 10 to write programs in c. Whenever I write programs that only outputs like:
printf("x\n");
The output got printed into the console. However when I write programs that asks for inputs, like:
c = getchar();
rather than going to the console, eclipse instead opens a terminal. I believe that is where you will type the input. This doesn't usually bother me, however my eyes are destroyed, I am using a screen reader and this terminal is somewhat inaccessible. It is usable, but can be very hard to use sometimes (E.G. my screen reader JAWS does not speak what I'm typing).
Is there a way for eclipse cdt to put all inputs and outputs directly to the console?

Unfortunately in this case eclipse console is read only. Better once compile and build your code go to the folder where it created your exe file and run that exe in command prompt and test.
open command prompt window (type cmd)
cd C:\path_to_your_exe\
yourexe
This will also help you in case your program takes command line parameters.

Related

codeblock exe keeps crashing instantly

I have made a c program with codeBlocks on windows 10, but the exe crashes as soon as I open it, actually it does not matter the program all exe produced by codeblocks won't run, maybe there are some problems with the settings? Cause if I run the program from inside codeBlocks it runs without problems, any suggestion?
You are compiling "command line programs", which don't open a window on their own. Since they apparently don't expect any user input they run to the end quite happily and quit.
If you want to run this type of programs, you need a shell, which provides a window.
This is a simple way to get one: Open a file explorer window and navigate to the directory containing your program. Click into the address bar so that it changes into a textual representation of the path. Replace all of it with the word cmd and press enter. Now the shell's window opens, commonly with white text on a black background. Enter the name of the program, and it will run.

CLion not running in Terminal

There's this bug with the placement of certain characters in the embedded terminal in CLion (the Run tab that pops up when you click the Run button), and I figured out that if I changed the terminal in CLion, that wouldn't happen. I changed the terminal to cmder, and it is all working now, except one thing: I can't figure out how to make CLion run the program to that terminal.
I tried changing the configuration, but all it did on run was open cmder but not execute the program (I had to run it manually, by writing the file name).
I wonder, what's the way to fix this, and make CLion directly run C programs on the terminal, instead of the Run tab?
Thank you.
The CLion run configuration always runs in the integreted run window. That is not a terminal emulator, and it cannot be changed so that it runs in an actual terminal emulator (like cmder).
Your best bet is to try to fix the "character placement" in the run window. Maybe ask a different question where you explain the issue, or if it's a clear bug, file a bug report for it.

Unable to run C programs using any compiler

I had to write code in C and run it for an assignment. Since this is the first time that I'm using C, I downloaded MinGW as a compiler and Code Blocks as an IDE. I had no problem compiling the code given by my professor but it never runs (this is a simulation for an M/M/1 queue). When I say it never runs, I mean that a command prompt like window pops up and nothing happens after that. Every time I close that window and try to compile the SAME program again, I get an error that says that permission to access the file has been denied.
I then deleted Code Blocks and tried running the program through command prompt but I have the same problem. I've now tried doing it using LCC-Win but nothing has changed. Another weird thing that happens when I run any program is that three instances of the .exe file of that particular program are in my processes under task manager. I then need to restart my computer to try compiling that same program.
I even tried running a simple Hello World program and I have the same problem!
I am currently using a Windows 7 32-bit system.
Any help would be greatly appreciated!

How to detect Console or Windows Application?

I am trying to write a icon changing program like resource hacker. I am able to change icons of windows programs but not console programs and I think thats quite obvious. So I want to write a code in my program that will check if the argument exe file is a console program or windows program before it tries to change the icons.
So how do I check if an exe file is a console program or windows program. I am writing program in C using visual studio.
The Subsystem value inside the Portable Executable header of the file will give you the info:
WINDOWS_CUI 3 Runs in the Windows character subsystem (a console app)

cygwin terminal converts my letters to numbers

I recently coded a '.C' file with scanf in order to take keyboard inputs. To my great surprise, the cygwin terminal converted all the letters I typed to numbers. My program ran properly though. The cygwin terminal just didn't show the correct input that I typed. It even converted some non-alphabet keys into symbols.
If I pressed the same alphabet key multiple times, the numbers (showing up in the cygwin terminal) would change each time I pressed the key. I talked to my computer science professor about this and he didn't know how to fix it.
Another thing to be noted is that my professor was able to use the cygwin executable(?) via the command terminal in order to run my '.C' file. When he ran the program in this way, the command terminal was able to accept letters.
I got the cygwin installation package from the GATech mirror website and this is the first error I've come across using cygwin.
I am using windows XP and netbeans to run the '.C' ;
check your .(bash)rc settings, try alternativ "consoles" (mintty, xterm,...)
...was able to use the cygwin executable...
they are still windows .exe files

Resources