Thread: Glib and file manipulation

  1. #1
    Registered User unixOZ's Avatar
    Join Date
    Feb 2002
    Posts
    91

    Question Glib and file manipulation

    Hello, Im writting a font end for a webserver in GTK+ 2.This webserver has its config file in the format:
    ServerRoot SomeValue
    PidFile Path

    Everything is fine, only that my function (void writeconf()) for changing the values, corrupts (sometimes and with only some variables which seem to be random) the servers config file. I have even tried to use this function without GTK and still doesnt work correctly.
    Here is the URL for the file where the function is (I think its too long to type it here):

    fileio.c
    fileio.h
    Thanks!
    Last edited by unixOZ; 03-21-2004 at 03:34 PM.
    http://www.igloo.cl/~unixoz

  2. #2
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    I can't get your code to even compile. I added the necessary includes even you .h but I get alot of errors
    Code:
    In file included from fileio.c:24:
    fileio.h:30: warning: no semicolon at end of struct or union
    fileio.h:30: error: syntax error before '=' token
    fileio.c: In function `write_config_file':
    fileio.c:33: warning: implicit declaration of function `set_config_xml'
    fileio.c: In function `create_dir':
    fileio.c:43: warning: implicit declaration of function `mkdir'
    fileio.c:43: error: `S_IRUSR' undeclared (first use in this function)
    fileio.c:43: error: (Each undeclared identifier is reported only once
    fileio.c:43: error: for each function it appears in.)
    fileio.c:43: error: `S_IWUSR' undeclared (first use in this function)
    fileio.c:43: error: `S_IXUSR' undeclared (first use in this function)
    fileio.c: In function `get_config_xml':
    fileio.c:98: error: `xmlDocPtr' undeclared (first use in this function)
    fileio.c:98: error: syntax error before "doc"
    fileio.c:99: error: `xmlNodePtr' undeclared (first use in this function)
    fileio.c:102: error: `doc' undeclared (first use in this function)
    fileio.c:102: warning: implicit declaration of function `xmlParseFile'
    fileio.c:104: warning: implicit declaration of function `err_msg'
    fileio.c:108: error: `cur' undeclared (first use in this function)
    fileio.c:108: warning: implicit declaration of function `xmlDocGetRootElement'
    fileio.c:111: warning: implicit declaration of function `xmlFreeDoc'
    fileio.c:120: warning: implicit declaration of function `xmlGetProp'
    fileio.c:120: error: syntax error before "xmlChar"
    fileio.c:121: error: syntax error before "xmlChar"
    fileio.c: In function `check_file':
    fileio.c:155: error: storage size of `filestat' isn't known
    fileio.c:157: warning: implicit declaration of function `stat'
    fileio.c:155: warning: unused variable `filestat'
    fileio.c: In function `readconf':
    fileio.c:190: error: invalid application of `sizeof' to an incomplete type
    fileio.c:197: error: dereferencing pointer to incomplete type
    fileio.c:198: error: dereferencing pointer to incomplete type
    fileio.c:202: warning: implicit declaration of function `err_quit'
    fileio.c:205: error: dereferencing pointer to incomplete type
    fileio.c:222: error: dereferencing pointer to incomplete type
    fileio.c:225: error: dereferencing pointer to incomplete type
    fileio.c:228: error: dereferencing pointer to incomplete type
    fileio.c:230: error: dereferencing pointer to incomplete type
    fileio.c:232: error: invalid application of `sizeof' to an incomplete type
    fileio.c:233: error: dereferencing pointer to incomplete type
    fileio.c:234: error: dereferencing pointer to incomplete type
    fileio.c:235: error: dereferencing pointer to incomplete type
    fileio.c:243: error: dereferencing pointer to incomplete type
    fileio.c:245: error: dereferencing pointer to incomplete type
    fileio.c:246: error: dereferencing pointer to incomplete type
    fileio.c:256: error: dereferencing pointer to incomplete type
    fileio.c:262: error: dereferencing pointer to incomplete type
    any luck fixing it yet?
    oh and compiled with
    Code:
    gcc -Wall -g fileio.c -o fileio `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with a GLIB
    By giladist in forum C Programming
    Replies: 3
    Last Post: 05-26-2007, 11:29 PM