teste
Dependencies: mbed BSP_DISCO_F746NG FatFS
Diff: main.cpp
- Revision:
- 3:d9c0b24b6f84
- Parent:
- 2:19c2835ce409
--- 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);