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,14 +21,28 @@
|
||||||
*/
|
*/
|
||||||
#include "../../Include/Iony/Core/Console.h"
|
#include "../../Include/Iony/Core/Console.h"
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <windows.h>
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
IonyError iony_print(char *text) {
|
IonyError iony_print(char *text) {
|
||||||
if (text == ((void*)0)) {
|
if (text == 0) {
|
||||||
return IONY_ERROR_INVALID_POINTER;
|
return IONY_ERROR_INVALID_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
unsigned long text_length = 0;
|
||||||
|
while (text[text_length] != '\0') {
|
||||||
|
text_length += 1;
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(__linux__)
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue