ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
console.cpp
1// #################################################################################################
2// ALib C++ Library
3//
4// Copyright 2013-2024 A-Worx GmbH, Germany
5// Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6// #################################################################################################
8
9#if !DOXYGEN
11# include <cstdlib>
12# if defined( _WIN32 )
13# elif defined(__GLIBCXX__) || defined(__ANDROID_NDK__)
14# include <sys/ioctl.h>
15# include <unistd.h>
16# elif defined(__APPLE__)
17# include <unistd.h>
18# include <sys/sysctl.h>
19# else
20# pragma message ("Unknown Platform in file: " __FILE__ )
21# endif
22#endif // !DOXYGEN
23
24
25namespace alib::lang::system {
26
27
28// static instance representing current process
30
31
32int Console::GetWidth( bool forceRedetect )
33{
34 if( Console::lastReceivedWidth >= 0 && !forceRedetect )
36
37
38 #if defined (_WIN32)
39
40 #elif defined(__GLIBC__) && defined(__unix__) || defined(__ANDROID_NDK__)
41
42 struct winsize w;
43 if( ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != 0 )
45 else
47
48 #elif defined (__APPLE__)
49
50 #else
51 #pragma message ("Unknown Platform in file: " __FILE__ )
52 #endif
53
55}
56
57} // namespace [ alib::lang::system]
static ALIB_API int GetWidth(bool forceRedetect=false)
Definition console.cpp:32
static ALIB_API int lastReceivedWidth
Console text width.
Definition console.hpp:28
This is the reference documentation of sub-namespace system of module ALib BaseCamp.
Definition basecamp.cpp:75