N
N
Negro2022-03-02 14:53:12
Rust
Negro, 2022-03-02 14:53:12

How to resize console in rust?

As far as I know, in c++ you can set the size of the opened console in pixels with a few lines. Maybe it can also be done in rust using the standard library or some other tools?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2022-03-02
Vitalya @negr_vitalya

As far as I know, in c++ you can set the size of the opened console in pixels with a few lines.

But only on Windows and only using Windows APIs, and it will only work with the old console.
There is a windows crate for this - https://crates.io/crates/windows
You should use the SetConsoleWindowInfo function (or which function did you use there?):
https://docs.microsoft.com/en-us/windows/console/s ...
Or an alternative, for the new console, but not in pixels, but in columns:
https://docs.microsoft.com/en-us/windows/console/c...
Just write the appropriate sequence of characters to the console (well, or use some kind of abstraction like crossterm or termion)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question