uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
test.c
Go to the documentation of this file.
1 #include <FreeRTOS.h>
2 #include <task.h>
3 #include <semphr.h>
4 #include <BoardConsole.h>
5 #include <stdio.h>
6 #include <fio.h>
7 #include <romfs.h>
8 #include <semifs.h>
9 #include <malloc_wrapper.h>
10 
11 static const char msg[] = "Hello world - from fwrite!\r\n";
12 
13 extern uint8_t _binary_romfs_bin_start[];
14 
15 int main() {
17  FILE * f1, * f2;
18  char buf[32];
19  int c;
22  printf("Hello world - from stdio!\r\n");
23  fflush(stdout);
24  f1 = fopen("/dev/stdout", "w");
25  fprintf(stderr, "f1 = %p\r\n", f1);
26  fwrite(msg, 1, sizeof(msg), f1);
27  f2 = fopen("/romfs/test.txt", "r");
28  c = fread(buf, 1, 32, f2);
29  fwrite(buf, 1, c, f1);
30  fflush(f1);
31  fclose(f1);
32  fclose(f2);
33  return 0;
34 }