Good morning!

I have a problem using fprintf.
I try to print a linked list which consists of nodes(structs).
When i try to print the list to the standard output using printf evrything is ok
e.g. i do :

printf("%d, %d, %s, %s\n",p->l, p->t, p->a, p->b);

//p is pointer to the struct

Now i try to print the linked list in a file i do:
Code:
if( ( fp = fopen(argv[1],"w") ) == NULL )
                        printf("File couldn't be opened\n");
                else {
                        p = head;
                        while( p != NULL) {
                                fprintf(fp, "%d, %d,%s,%s\n",p->l, p->t, p->a, p->b);
                                p = p->next;
                                        }
                        }
                 fclose(fp);


But nothing is being typed to the file!
What do i do wrong?

Thanks in advance!