Got the MSFS file RAMDISK demo running. Using the shell, I can write to a file. If I specify 6 bytes, and read it back, I get "012345".
Now I want to write my own data using MSFS. How do I do this? Do I use a printf? Or _io_write? How do I convert the numbers? Do I use the standard conversion specifier like you would in a printf/fprintf (e.g. d, f, x, etc)
Thanks,
Yes to all of your questions.
You can use _io_write (or write) to write binary or untranslated text data to the file.
You can use the formatted I/O functions (fprintf, etc) to write test to a file. An you can use the standard conversion specifiers.
Look at logging_task.c in the hvac demo for a simple example using write.
Hello
I have goot running mfs_sdcard_twrmcf51cn128 demo. I have been testing all commands. Whe I try "write" command,
parameters <seek_mode> and <offset> seem to have no effect. Any try a do, I got some thing like:
Could be this a bug? or am I making some mistake?
I´ll appreciate any help
Hello
Looking at file:
C:\ProgramFiles\Freescale\Freescale MQX 3.6\shell\source\mfs\sh_write.c
I founf these lines
// generate data to buf
for (i = 0, c = '0', bi = 0; i < count;i++) {
buf[bi++] = c;
if (bi > SHELL_BLOCK_SIZE - 1) {
write(fd, buf, SHELL_BLOCK_SIZE);
bi = 0;
}
if (c == 'z')
c='0';
else
c++;
}
third parameter(offset) is not taken into account when data is generate. After figuring out this code , command "write" could be inproved by user. It is important that any addition you come up with to keep function reentrance feature.
Thanks.
Hello, I did not understand your last comment. Are you reporting a bug / improvement?