Oeps, found it myself :-) I should have done :
#define LOGFILE "/APPHOME/applogfile"
...
LogFile = fopen(LOGFILE,"w");
I think I should buy a better C-book. My book (a dutch one, not very known)
defines #define as follows :
#define identifier string
with an example : #define TITLE This is the title.
So I thought that i didn't have to add "" around my logfile-description ...
My friend says that I should buy the K&R but i think I read somewhere that
it's 'old C', not ANSII C. Is this correct ?
> -----Oorspronkelijk bericht-----
> Van: Johan De Messemaeker
> Verzonden: dinsdag 2 maart 1999 11:13
> Aan: Linux-C-Programming mailing list (E-mail)
> Onderwerp: Yet another beginners question ...
>
> I'm writing a program and i have the following question. I'm defining a
> homedirectory and logfile for my application like this
>
> #define LOGFILE /APPHOME/applogfile /* APPHOME is the actual home
> directory for the application */
>
> But when i try to delete the old logfile and open the logfile like below,
> it doesn't work (it won't access the file described as above, instead, it
> creates a file LOGFILE in the directory where i run the program.
>
> FILE *LogFile;
> remove("LOGFILE"); /* First remove the old logfile */
> LogFile = fopen("LOGFILE", "w");
>
> .
> .
> do some stuff
> .
> .
> fclose("LOGFILE");
>
> What is the problem ?
>
> De Messemaeker Johan
> HEMMIS n.v.
> Koning LeopoldIII-laan 2, 8500 Kortrijk
> Tel.: 32 (0)56/37.26.37
> Fax: 32 (0)56/37.23.24
> Current Project : VMM Aalst
>