hello,
kill button* kill func* log off func void toggle1 (void) { credit++; } func void toggle2 (void) { lecture_switch_start_stop = 1; } signal void affichage (void) { while (1) { exec("log>C:\log.txt"); //LIGNE1 printf ("%u,%u,u%,u%,\n",display_J1,display_J2,display_J3,display_J4, display_J5,display_J6,display_J7); exec("log off"); //LIGNE2 twatch (2000); } } define button "insert credit","toggle1 ()" define button "start stop","toggle2 ()" define button "start simulation", "affichage ()"
the command of ligne 2 (log off) is ok but the command of ligne 1 doesn't begin to log if I do this command to time I have an error that the file is already open. but I have nothing in my log.txt file.
what do I wrong??
I realy need to close and after to reopen the log file because I only want to have 1 ligne printing in my log.file.
thanks for your help.
I think there are several problems with the code you presented.
1. Your format string is strange. In "%u,%u,u%,u%,\n" I'm not sure that %, outputs what you mean for it to output.
2. There are more arguments in the printf call than there are format specifiers in the format string.
3. If you want to append to an existing file, you need to use log >> filename. Your current exec statement will overwrite the output each time it is called.
Take a look at http://www.keil.com/support/man/docs/uv3/uv3_cm_log.htm for more information on the LOG command.
Jon