feat(console output): implemented printing to console for windows
This commit is contained in:
parent
bdc3b26f97
commit
2357205470
1 changed files with 18 additions and 4 deletions
|
|
@ -21,15 +21,29 @@
|
|||
*/
|
||||
#include "../../Include/Iony/Core/Console.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#endif
|
||||
|
||||
IonyError iony_print(char *text) {
|
||||
if (text == ((void*)0)) {
|
||||
if (text == 0) {
|
||||
return IONY_ERROR_INVALID_POINTER;
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#elif defined(__linux__)
|
||||
unsigned long text_length = 0;
|
||||
while (text[text_length] != '\0') {
|
||||
text_length += 1;
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
static HANDLE standard_console_out_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
DWORD characters_written;
|
||||
WriteFile(standard_console_out_handle, text, text_length, &characters_written, 0);
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#endif
|
||||
|
||||
return IONY_ERROR_NONE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue