/programs/develop/ktcc/trunk/libc/stdio/conio.c |
---|
74,6 → 74,15 |
int con_init_console_dll(void) |
{ |
return con_init_console_dll_param(-1, -1, -1, -1, con_caption); |
} |
int con_init_console_dll_param(dword wnd_width, dword wnd_height, |
dword scr_width, dword scr_height, const char* title) |
/* work as con_init_console_dll, but call con_init with params |
*/ |
{ |
struct import * hDll; |
if (__console_initdll_status == 1) return 0; |
84,10 → 93,10 |
} |
con_lib_link(hDll, con_imports); |
con_init(-1, -1, -1, -1, con_caption); //__argv[0] && __path dont work |
con_init(wnd_width, wnd_height, scr_width, scr_height, title); |
__console_initdll_status = 1; |
return(0); |
return 0; |
} |
/programs/develop/ktcc/trunk/libc/stdio/fopen.c |
---|
2,21 → 2,28 |
#include <string.h> |
#include <stdlib.h> |
int errno = 0; |
/* |
// removed by Seiemargl 26-oct-2018 |
// use get_current_folder() from kos32sys.h instead |
extern char __argv; |
extern char __path; |
int errno = 0; |
// convert relative to program path ./file.txt to absolute |
const char* getfullpath(const char *path){ |
int relpath_pos, localpath_size; |
char *programpath; |
char *newpath; |
char *prgname; |
if (path[0] == '/') /* root */ |
if (path[0] == '/') // |
{ |
return(strdup(path)); /* dup need as free in fclose() */ |
return(strdup(path)); // dup need as free in fclose() |
} |
relpath_pos = 0; |
49,9 → 56,9 |
return(newpath); |
} |
*/ |
FILE* fopen(const char* filename, const char *mode) |
{ |
FILE* res; |
92,7 → 99,8 |
if (*mode!=0) |
return NULL; |
fullname = (char*)getfullpath(filename); |
// fullname = (char*)getfullpath(filename); |
fullname = strdup(filename); |
if ((imode & 3) == FILE_OPEN_READ && fullname) /* check existense */ |
{ |
sz = _ksys_get_filesize(fullname); |