teste

Dependencies:   mbed BSP_DISCO_F746NG FatFS

Files at this revision

API Documentation at this revision

Comitter:
nextronic
Date:
Sat Aug 24 12:32:52 2019 +0000
Parent:
2:19c2835ce409
Commit message:
firsye Commit

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Feb 04 10:12:09 2018 +0000
+++ b/main.cpp	Sat Aug 24 12:32:52 2019 +0000
@@ -49,10 +49,10 @@
     if(res!= FR_OK)
         pc.printf("Failed to mount SD\n");
 
-    res = f_open(&MyFile, "image.ppm",  FA_READ);
+    res = f_open(&MyFile, "img.ppm",  FA_READ);
     if(res!= FR_OK)
         pc.printf("Failed to open file\n");
-    
+
     // Read image header and get image size
     while(res==FR_OK) {
         res = f_read(&MyFile, &c, 1, (UINT*)&bytesread);
@@ -134,6 +134,42 @@
     }
 
     pc.printf("Done!\n");
+    
+    
+    
+    /*
+    char ch;
+    
+    res = f_open(&MyFile, "data.txt",  FA_READ);
+    if(res!= FR_OK)
+        pc.printf("Failed to open file\n");
+
+    else
+        pc.printf("open file ok\n");
+    */
+    
+        
+        
+   FILE*   fp = fopen("/data.txt", "r");
+   pc.printf("%s\n", (!fp ? "Fail :(" : "OK"));
+   if (!fp)
+       //error("error: %s (%d)\n", strerror(errno), -errno);
+       pc.printf("ARARA");
+   while (!feof(fp)) {
+       int c = fgetc(fp);
+       pc.printf("%c", c);
+   }
+   pc.printf("\r\n");
+   fclose(fp);
+    
+    
+
+    
+    
+    
+    
+    
+    
     f_close(&MyFile);
     FATFS_UnLinkDriver(SDPath);