All Questions
510
questions
1
vote
1
answer
87
views
GetConsoleScreenBufferInfo returning wierd values when called using function
I have a program where I want to print out the size of the terminal window in columns and rows.
To do this I want to call this function from int main():
int getConsoleSize(){
...
1
vote
1
answer
134
views
How to properly and safely print to stdout/stderr using the Win32 API?
You may say.
//#DEFINE UNICODE
#include <Windows.h>
int main()
{
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
LPTSTR msg = TEXT("Hello, World!\n");
WriteConsole(hOut, ...
0
votes
1
answer
56
views
Answering a scanf() within the program
I am trying to program a C Crash course for students in VPL. The students write a program in a file and I try to compile it with a another file I wrote to grade the program the students wrote.
The ...
0
votes
2
answers
81
views
How can you print out different strings in different coordinates?
I have to make a table and I don't want to hard code it.
COORD point = { 30, 10 };
SetConsoleCursorPosition(hConsole, point);
printf("%s", a);
COORD point1 = { 30,12 };
...
3
votes
1
answer
267
views
How to clear the console input buffer
I'm basically making my own console I/O, (so no cout, cin, etc) but sometimes when I read the input I don't read all the characters on the buffer, because I can select how much I want to read. But the ...
1
vote
0
answers
56
views
Clear all data flushed to stdout in C
My program needs to dynamically update what was outputted to the console. How can I do this?
The outputted number of lines can vary, so \r tricks won't be easy to implement.
There is __fpurge in Linux,...
-1
votes
1
answer
70
views
C console application's compiling doesn't return errors but also doesn't run the code
Two days ago I posted this question about organizing multiple .c and .h files in a console application project. I followed everybody's guidance and advices from there and it led me to this project ...
0
votes
1
answer
76
views
C console application - file/header organization and compiling
I'm having a hard time organizing multiple .c and .h files into my console application project - and also, I'm a little unsure on how the compiling command should be written. I'm gonna list my files ...
1
vote
0
answers
65
views
Reparenting a console host window has rendering issues
I reparented the console window retrieved by AllocConsole() to a window owned by a different process using the following code:
SetParent(console, main_window_handle);
SetWindowLongPtr(console, ...
0
votes
1
answer
31
views
C-W is deleting my command prompt - how to stop this
I'm working on a small shell and using libreadline to get command input.
problem
My command prompt is getting deleted when I use C-W
note this only happens after I enter a word and then C-W, C-w ...
0
votes
0
answers
51
views
Typed text is not displaying in console while using conio.h
I am using conio.h in my project to display the game board. I need to read input from a user. In generally works, but it behaves like linux passwords (input is passed to a variable but not displayed ...
0
votes
1
answer
88
views
Why doesn't system("cls") work for me on windows?
i have been trying to make my screen refresh every second and i don't understand why it doesn't work.
The countdown works but i want to show only the last "printf" and remove all the other ...
0
votes
0
answers
41
views
KandR2 Entab program clarification
This is Exercise 5-11 in the KandR2 book.
Exercise 5-11. Modify the program "entab" and "detab" (written as exercises in Chapter 1.) to accept a list of tab stops as arguments. ...
1
vote
0
answers
55
views
How to enter values in brackets and numbers with a degree in C console
I have an array of unsigned long long int type, the values are entered in one line through the console, among the numbers there are (2^32-1)^2-1 and (2^32-1)^2+1.
How can I convert this to a natural ...
0
votes
0
answers
47
views
How do I correctly handle console operations with char type in C?
I'm doing a logic exercise (begginer stuff) in which the user is presented with the options to type "A" for an arithmetic average of his school grades and "W" for a weighted ...