Dangerous Prototypes

Other projects => Past projects => Web platform => Topic started by: mcdanne82 on April 13, 2010, 06:40:51 pm

Title: How to create a new file?
Post by: mcdanne82 on April 13, 2010, 06:40:51 pm
Hi
I run a modified version of MCstackDemo2.
I would like to ad a type of log file to the webserver. If the log file dosent exist it should be created.
Have anybody tested something like this?

//Daniel
Title: Re: How to create a new file?
Post by: bonybrown on April 19, 2010, 05:25:01 am
No, haven't tried yet, but writing files to the SD card is something that I will want to do ( when I get to that bit ).

If you've configured UART 1correctly, and are able to send data back to a PC using printf() - that is, you've created an implementation of _mon_putc(char c ), something like so:
Code: [Select]
void _mon_putc(char c){
while(U1STAbits.UTXBF == 1); //if buffer is full, wait
    U1TXREG = c;
}

Then you could log requests to the serial port by simply adding printf() statements in the SM_HTTP_PARSE_REQUEST switch case in HTTP2_MDD.c
Once that's successful, it should be a short jump to writing it to a file instead ( swap printf() from stdio.h to FSvfprintf() from FSIO.h )

Tony.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.00862039792session_write_close ( )...(null):0
20.00892171368ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.00892172144Database_MySQL->query( ).../DatabaseHandler.php:119
40.05362310864Database_MySQL->error( ).../Db-mysql.class.php:273