Hi Mike,
Is it possible to upload a file to the local file system space or SD card using usb serial rather than treating the local file system space as mass storage?
You could certainly do that. You'd basically write a program that did the following:
- open a file for write on localfilesystem
- listen on serial port, and write anything you get to the file
- when you see some sort of delimiter or whatever you decide to signify the file is transfered, close the file.
Maybe something like this (untested!):
#include "mbed.h"
LocalFileSystem local("local");
Serial device(p9, p10);
int main() {
FILE *fp = fopen("/local/file.txt", "w");
char c;
while((c = device.getc()) != 0) {
fputc(c, fp);
}
fclose(fp);
}
Hope that gives you some ideas to start with.
Simon
Hi,
I would like an example if anyone has one of how I could read the contents of a certain line number using the local file system? I want to read in a line of text starting from the first line into a container and then read the following lines in turn until the end of the file. I have had a look through the forums and couldn't find a snippet of code showing how this could be done, and as i'm very new to all this I need some help.
Thanks.
Mike.