Procházet zdrojové kódy

Merge pull request #7 from misonyo/master

修改读写提示信息位置
yqiu před 7 roky
rodič
revize
4c990a43e8
1 změnil soubory, kde provedl 2 přidání a 4 odebrání
  1. 2 4
      readwrite_sample.c

+ 2 - 4
readwrite_sample.c

@@ -29,21 +29,19 @@ static void readwrite_sample(void)
     {
     {
         write(fd, s, sizeof(s));
         write(fd, s, sizeof(s));
         close(fd);
         close(fd);
+        rt_kprintf("Write done.\n");
     }
     }
 
 
-    rt_kprintf("Write done.\n");
-
     /* 以只读模式打开 /text.txt 文件 */
     /* 以只读模式打开 /text.txt 文件 */
     fd = open("/text.txt", O_RDONLY);
     fd = open("/text.txt", O_RDONLY);
     if (fd >= 0)
     if (fd >= 0)
     {
     {
         size = read(fd, buffer, sizeof(buffer));
         size = read(fd, buffer, sizeof(buffer));
         close(fd);
         close(fd);
+        rt_kprintf("Read from file test.txt : %s \n", buffer);
         if (size < 0)
         if (size < 0)
             return ;
             return ;
     }
     }
-
-    rt_kprintf("Read from file test.txt : %s \n", buffer);
 }
 }
 /* 导出到 msh 命令列表中 */
 /* 导出到 msh 命令列表中 */
 MSH_CMD_EXPORT(readwrite_sample, readwrite sample);
 MSH_CMD_EXPORT(readwrite_sample, readwrite sample);