how create file with c in Apache Process Lifecycle?

Discussion in 'Apache' started by Hr8, Apr 9, 2007.

  1. #1
    Hi all.
    I want write Apache module with c, which in Lifecycle can create a file. How can i do it?
    Thanks for attention:)
     
    Hr8, Apr 9, 2007 IP
  2. Hr8

    Hr8 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    why this work.

    static void *create_my_dir_config(pool *p, char *d)
    {
    fopen( "my_file", "a" );

    **********
    }

    module MODULE_VAR_EXPORT my_module = {
    STANDARD_MODULE_STUFF,
    NULL, /* initializer */
    create_my_dir_config, /* dir config creator */
    NULL, /* dir config merger */
    NULL, /* server config creator */
    NULL, /* server config merger */
    NULL, /* command table */
    NULL, /* handlers */
    NULL, /* filename translation */
    NULL, /* check_user_id */
    NULL, /* check auth */
    NULL, /* check access */
    NULL, /* type_checker */
    NULL, /* fixups */
    NULL, /* logger */
    NULL, /* header parser */
    NULL, /* child_init */
    NULL, /* child_exit */
    NULL /* post read-request */
    };



    ///////////////////////////////////
    but this dont work.

    static int my_translation(request_rec *r)
    {
    fopen( "my_file", "a" );

    ************


    return OK;
    }



    module MODULE_VAR_EXPORT my_module = {
    STANDARD_MODULE_STUFF,
    NULL, /* initializer */
    NULL, /* dir config creator */
    NULL, /* dir config merger */
    NULL, /* server config creator */
    NULL, /* server config merger */
    NULL, /* command table */
    NULL, /* handlers */
    my_translation, /* filename translation */
    NULL, /* check_user_id */
    NULL, /* check auth */
    NULL, /* check access */
    NULL, /* type_checker */
    NULL, /* fixups */
    NULL, /* logger */
    NULL, /* header parser */
    NULL, /* child_init */
    NULL, /* child_exit */
    NULL /* post read-request */
    };


    ///////////////////////////
    in a first example file was created, but in second example wasn't created?
     
    Hr8, Apr 9, 2007 IP