Oppgave9.1
Dependencies: mbed
main.cpp@0:7591d1dbca76, 2017-10-31 (annotated)
- Committer:
- Smashftw
- Date:
- Tue Oct 31 12:43:49 2017 +0000
- Revision:
- 0:7591d1dbca76
Oppgave 9.1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Smashftw | 0:7591d1dbca76 | 1 | #include "mbed.h" |
Smashftw | 0:7591d1dbca76 | 2 | |
Smashftw | 0:7591d1dbca76 | 3 | DigitalOut Led1(LED1); |
Smashftw | 0:7591d1dbca76 | 4 | LocalFileSystem local("local"); |
Smashftw | 0:7591d1dbca76 | 5 | int main() |
Smashftw | 0:7591d1dbca76 | 6 | { |
Smashftw | 0:7591d1dbca76 | 7 | int i=0, t=0; |
Smashftw | 0:7591d1dbca76 | 8 | |
Smashftw | 0:7591d1dbca76 | 9 | FILE *fp = fopen("/local/fil1.txt", "w"); |
Smashftw | 0:7591d1dbca76 | 10 | if (fp == NULL) { |
Smashftw | 0:7591d1dbca76 | 11 | Led1 = 1; |
Smashftw | 0:7591d1dbca76 | 12 | return 1; |
Smashftw | 0:7591d1dbca76 | 13 | } |
Smashftw | 0:7591d1dbca76 | 14 | |
Smashftw | 0:7591d1dbca76 | 15 | while (i < 100) { |
Smashftw | 0:7591d1dbca76 | 16 | for(t=0; t<10; t++) { |
Smashftw | 0:7591d1dbca76 | 17 | fprintf(fp,"%3d", i); |
Smashftw | 0:7591d1dbca76 | 18 | i++; |
Smashftw | 0:7591d1dbca76 | 19 | } |
Smashftw | 0:7591d1dbca76 | 20 | |
Smashftw | 0:7591d1dbca76 | 21 | fprintf(fp, "\n"); |
Smashftw | 0:7591d1dbca76 | 22 | |
Smashftw | 0:7591d1dbca76 | 23 | } |
Smashftw | 0:7591d1dbca76 | 24 | fclose(fp); |
Smashftw | 0:7591d1dbca76 | 25 | return 0; |
Smashftw | 0:7591d1dbca76 | 26 | |
Smashftw | 0:7591d1dbca76 | 27 | |
Smashftw | 0:7591d1dbca76 | 28 | } |