Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

32-bit MSDOS (Announce)

posted by marcov, 03.07.2021, 14:47

> > void fpc_write_text_shortstr(int handle, char *str)
> > {
> > fputs(str, (FILE*)handle);
> > return;
> > }
>
> This signature doesn't match. shortstrings are complicated beasts.

This was wrong, they are not really complicated, being simply one byte length and up to 255 characters of character data. (const often means by reference in these context). And not null terminated, iow it needs conversion to change into null terminated pointer.

> Only replace the final call to the OS (in rtl/win/sysfile).

In this case as WriteFile is untyped I/O. Use raw/untyped I/O. e.g. posix Write() rather than fputs.

Then you can write

if length(s)>0 then
posix_write(@s[1],length(s)); // create pointer to first real character (s[0]=length)

 

Complete thread:

Back to the forum
Board view  Mix view
22632 Postings in 2109 Threads, 402 registered users, 368 users online (0 registered, 368 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum