Hello Nils, hello Ken,

ptr_array[0] = malloc(size_of_textfile);
copy_to(file0, ptr_array[0];
ptr_array[1] = malloc(size_of_textfile);
copy_to(file1, ptr_array[1];
...
Can I still use fgets() on these pointers once the file has been loaded
there?
No, fgets wants a FILE *, which is a pointer to a stream, not a char *.
If you are not able to rewrite the program to process the buffer
directly, forgetting about fgets(), there is fmemopen() which returns a
FILE * given a string. But it may not be implemented in your C library.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html

I just found that the Newlib library as included in the gcc-ia16 toolchain does happen to implement fmemopen( ) (and several other POSIX functions as well).

However, Open Watcom's C library does not have this function.

I suppose, if a `FILE *' is not absolutely needed, then one can use strchr( ), strcspn( ), etc. to slice the input up into separate lines, without writing a lot of code.

Thank you!

--
https://github.com/tkchia


_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to