diff --git a/APP_Framework/Applications/main.c b/APP_Framework/Applications/main.c index b10557a97..22b0d7dfc 100644 --- a/APP_Framework/Applications/main.c +++ b/APP_Framework/Applications/main.c @@ -17,6 +17,31 @@ extern int FrameworkInit(); extern void ApplicationOtaTaskInit(void); + +void TestFileSystem (){ + int ret = 0; + char w_buf[] = "hello world!"; + char r_buf[20]; + + int fd_t = open("/hello.txt", O_RDWR | O_CREAT); + if(fd_t >0){ + ret = write(fd_t, w_buf, strlen(w_buf)); + if(ret < 0){ + printf("fd = %d write hello world failed.\n",fd_t); + return NULL; + } + close(fd_t); + + fd_t = open("/hello.txt", O_RDONLY); + ret = read(fd_t, r_buf, 20); + if(ret > 0) + printf("read len %d, r_buf %s\n",ret,r_buf); + close(fd_t); + } +} +PRIV_SHELL_CMD_FUNCTION(TestFileSystem, a filesystem test sample using sd + card, PRIV_SHELL_CMD_MAIN_ATTR); + int main(void) { printf("Hello, world! \n");