I have a problem with this program: I was able to make another draft program but it only reads the first three lines and stops. Unfortunately, the input file is not symmetrical so I should use while loops for some parts only to avoid repeating parts of the program. With strcpy I could copy the work done up to a certain point and then continue from that point on. I was trying but visual studio tells me to move the memory to the heap but I don't know how to do it ... Practically I should only extrapolate certain data from the input file and order them in an output file according to a precise line. I also know there's a problemi with char buf[200], rec[200] because I have to allocate much more memory...
the first time in
you call
feofbefore any read sofeofcannot work proprely, an easy change is to doOut of that the mode can be something else that
COPY MODEand the two\nafter are not mandatory, you also do not check your nextfscanfsuccess and globaly the algorithm you use is wrongA possible way to do the job also checking the validity of the input file is :
Note the space at the beginning of the format of the
fscanf, that allows to bypass character considered to be space including the newlineCompilation and execution :