I am trying to extract a line from a file with some cstdio function, and seems that there isn't a function that directly gives you the line unless you give the program the size of the line or the line itself ("this is the line"), like fgets.
A priori, I don't know what is in the file, I just want to be able to copy separated lines from it.
Using iostream there is the "getline" function, but in cstdio I don't think there is something similar, any idea about this?
Now I realized that the problem was not fgets (it works as expected) but with the files I was using to test the program. They were .dat files created in Mac, that puts a CR at the end of the line instead a LF (UNIX). I copied the files from my mac to my linux computer and then, when running the program from there, it didn't identify the ends of line. I had to change the CR's to LF's and then it works.
So, at the end, this was a completely different problem...
When transferring text files between systems, always make sure to have it done using TEXT mode, which translates newlines properly. All other files (non-text files, of course) should be transferred in BINARY mode.