Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
bouguereau
Date:
Wed Aug 24 09:45:54 2011 +0000
Commit message:

Changed in this revision

fichier.cpp Show annotated file Show diff for this revision Revisions of this file
fichier.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fichier.cpp	Wed Aug 24 09:45:54 2011 +0000
@@ -0,0 +1,37 @@
+#include "fichier.h"
+
+LocalFileSystem local("local");
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+void tfichier :: testecriturefichier()              //Fonction OK
+{
+    FILE *test1 = fopen("/local/test.txt", "w");    // Création du .txt1 + Mise en écriture
+    fprintf(test1, "4");                            // écriture dans le .txt1
+    fclose(test1);                                  // fermeture du .txt1
+}
+
+void tfichier :: testlecturefichier()               // Fonction OK
+{
+    char tab[10];                                    // Création d'un tableau de 10 cases
+    FILE *test1 = fopen("/local/test.txt", "r");     // Mise en lecture du .txt1
+    fgets(tab, 10, test1);                           // Scan et mise en tableau du .txt1
+    FILE *test2 = fopen("/local/test2.txt", "w");    // Création du .txt2 + Mise en écriture  
+    fprintf(test2,tab);                              // écriture de tab dans .txt2
+    fclose(test2);                                   // fermeture du .txt1
+    fclose(test1);                                   // fermeture du .txt2
+}
+
+void tfichier :: testbinaire()
+{
+    char tab[10];                                    // Création d'un tableau de 10 cases
+    FILE *test1 = fopen("/local/test.txt", "r");     // Mise en lecture du .txt1
+    fgets(tab, 10, test1);                           // Scan et mise en tableau du .txt1
+    FILE *test2 = fopen("/local/test2.txt", "w");    // Création du .txt2 + Mise en écriture  
+    fprintf(test2,tab);                              // écriture de tab dans .txt2
+    fclose(test2);                                   // fermeture du .txt1
+    fclose(test1);                                   // fermeture du .txt2
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fichier.h	Wed Aug 24 09:45:54 2011 +0000
@@ -0,0 +1,17 @@
+#ifndef FICHIER_H
+#define FICHIER_H
+#include "mbed.h"
+
+class tfichier
+{
+
+private:
+
+public:
+    void testecriturefichier();
+    void testlecturefichier();
+    void testbinaire();
+ 
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Aug 24 09:45:54 2011 +0000
@@ -0,0 +1,8 @@
+#include "fichier.h"
+
+int main()
+{
+    tfichier obj ;
+    obj.testecriturefichier();
+    obj.testlecturefichier();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Aug 24 09:45:54 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9a9732ce53a1