[Fusion-C] Official Q&A thread

By raymond

Champion (456)

raymond's picture

29-09-2020, 20:05

I could not find any thread to ask questions about Fusion-C like there is for other topics so I started this one.

I have tried to search for some examples on how to work with files using Fusion-C, as I am trying to write to and read from a text or binary file. I can write data to a file, however when I read it again, it is completely different. Does someone has some examples on how to read/write to text and binary files using Fusion-C?

Login or register to post comments

By mcolom

Expert (123)

mcolom's picture

29-09-2020, 20:30

Works well for me: https://github.com/mcolom/MSX_lstate/blob/master/lstate.c
You need to call FCBs() first when working with files, though.

By ericb59

Paladin (996)

ericb59's picture

30-09-2020, 09:52

HI,

You can use this thread : https://msx.org/forum/msx-talk/development/msx-fusion-c-talk...

anyway, here an example how to use FCB to Create, Write, Read file
(Be aware of this example is for Fusion-C 1.3 which is not available right now. It works also with Fusion-c 1.2. Just rename the FCBs functions with the name they have in v1.2 : fcb_open, fcb_create, fcb_close, fcb_read, fcb_write)

https://drive.google.com/file/d/1EWUfj-tp0_ToaI1ji7AUGn64gvG...

By yustmenl

Rookie (20)

yustmenl's picture

02-10-2020, 12:59

ericb59 wrote:

HI,

You can use this thread : https://msx.org/forum/msx-talk/development/msx-fusion-c-talk...

anyway, here an example how to use FCB to Create, Write, Read file
(Be aware of this example is for Fusion-C 1.3 which is not available right now. It works also with Fusion-c 1.2. Just rename the FCBs functions with the name they have in v1.2 : fcb_open, fcb_create, fcb_close, fcb_read, fcb_write)

https://drive.google.com/file/d/1EWUfj-tp0_ToaI1ji7AUGn64gvG3pqKx/view?usp=sharing

thanks it looks like it solved our issue!