update testFileSystem
This commit is contained in:
parent
eb67b45f0f
commit
5724ecd109
|
@ -17,6 +17,31 @@
|
||||||
|
|
||||||
extern int FrameworkInit();
|
extern int FrameworkInit();
|
||||||
extern void ApplicationOtaTaskInit(void);
|
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)
|
int main(void)
|
||||||
{
|
{
|
||||||
printf("Hello, world! \n");
|
printf("Hello, world! \n");
|
||||||
|
|
Loading…
Reference in New Issue