I saw  on this website that this: fscanf(fin, "%[^\n]", &p); could be used for reading from my input file(fin) into  that char type pointer(*p) all the characters until the first enter hit. At some inputs it works properly, but at others it doesn't.
This is the input I should process and I cannot:
(((zahar 100 ou 3) 5 unt 100 nuca 200) 4 (lapte 200 cacao 50 zahar 100)3)20
This is my whole code:
#include <string.h>
#include <stdio.h>
FILE *fin, *fout;
int main()
{
    fin =  fopen("reteta.in", "r");
    fout = fopen("reteta.out", "w");
    char *p;
    p = new char[1001]();
    fscanf(fin, "%[^\n]", &p);
    fprintf(fout, "%s", &p);
    return 0;
}
 
     
    