From: John Hodge Date: Sun, 21 Aug 2011 08:53:05 +0000 (+0800) Subject: Usermode - AxWin2 notes, and a write support test app X-Git-Tag: rel0.11~135 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=2a3aced68d0c70f05ae816b885e3c16d681c720d;p=tpg%2Facess2.git Usermode - AxWin2 notes, and a write support test app --- diff --git a/Usermode/Applications/axwin2_src/notes.txt b/Usermode/Applications/axwin2_src/notes.txt new file mode 100644 index 00000000..d4090b9c --- /dev/null +++ b/Usermode/Applications/axwin2_src/notes.txt @@ -0,0 +1,3 @@ +Applications can have 0-* windows +Windows can have 1-* tabs +Each window has a menu based on a template from the application diff --git a/Usermode/Applications/writetest_src/Makefile b/Usermode/Applications/writetest_src/Makefile new file mode 100644 index 00000000..3b29575f --- /dev/null +++ b/Usermode/Applications/writetest_src/Makefile @@ -0,0 +1,12 @@ +# Project: Acess Network Tester + +-include ../Makefile.cfg + +CPPFLAGS += +CFLAGS += -Wall -fno-builtin -fno-stack-protector +LDFLAGS += + +BIN = writetest +OBJ = main.o + +include ../Makefile.tpl diff --git a/Usermode/Applications/writetest_src/main.c b/Usermode/Applications/writetest_src/main.c new file mode 100644 index 00000000..17a12ea6 --- /dev/null +++ b/Usermode/Applications/writetest_src/main.c @@ -0,0 +1,48 @@ +/* + * Write test + */ +#include +#include +#include + +// === CONSTANTS === +int main(int argc, char *argv[]) +{ + FILE *fp; + char *file; + char *text; + + // Check arguments + if(argc < 3) { + fprintf(stderr, "Usage: %s \"\"\n", argv[0]); + return EXIT_FAILURE; + } + + //file = argv[1]; + //text = argv[2]; + file = "/Mount/writetest.txt"; + text = "Written!\n"; + + printf("Testing File Output...\n"); + printf("file = '%s'\n", file); + printf("text = \"%s\"\n", text); + + // Open file + fp = fopen(file, "w"); + if(!fp) { + fprintf(stderr, "Unable to open '%s' for writing\n", file); + return EXIT_FAILURE; + } + + //printf("fwrite('%s', %i, 1, %p)\n", argv[2], strlen(argv[2]), fp); + if( fwrite(text, strlen(text), 1, fp) == -1 ) + { + fprintf(stderr, "Unable to write to '%s'\n", file); + return EXIT_FAILURE; + } + fclose(fp); + + printf("Wow, It worked!\n"); + + return EXIT_SUCCESS; +}