[Segmentation Fault] fopen("filename","w")
Hello everybody,
I've a strange problem in a small application I'm working at.
This program reads a file, elaborates some data then writes new data onto another file. The destination file is a fixed-name file, named "results": not a variable name.
Yesterday I tested the program with a file - input files have a very simple structure - and everything went fine. Today I written a slightly bigger input file and...
...and it causes my program crash (Seg.fault) while "fopening" the results file.
Here's the code in the writing function.
Code:
void processaDati(){
printf("Processing dati...\n\n");
FILE * file;
file=fopen ("risultati.psm","w");
int i;
printf("Let's begin...\n");
//Setup
fprintf(file, "def rAtomo = 1;\n");
//Other fprintf instructions omitted...
Maybe this piece of code is not very interesting, but I do not know what to post.
The curious problem is that the parsing & calculating phase of the program works well (I mean, it produces no errors!) so I believe the problem is not the input-file structure. Any hints?
Thanks a lot!