Akifumi Takahashi / Mbed OS eth-filesystem-sample
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "EthernetInterface.h"
00003 
00004 LocalFileSystem local("local");
00005 void func();
00006 EthernetInterface *net;
00007 
00008 int main()
00009 {
00010     func();
00011     net = new EthernetInterface();
00012     func();
00013     if(net->connect()) {
00014         printf("Error!@EthernetInterface::connect()\r\n");
00015     } else {
00016         printf("IP Address is %s\r\n", net->get_ip_address());
00017     }
00018     func();
00019 }
00020 
00021 
00022 void func()
00023 {
00024     static int i = 1;
00025     printf("-------test of fopen()#%d----\r\n", i);
00026     if(fopen("/local/test.txt", "r")==NULL)
00027         printf("File could not open\r\n");
00028     else
00029         printf("File was opened successfully.\r\n");
00030     i++;
00031 }