Home Forums C Programming Some problems in C++ Re: Re: Some problems in C++

#3506
GWILouisaxwzkla
Participant

The first function “read” looks ok to output the file data one word per line ,except I would probably pass the user’s name as a parameter instead of a global variable :

the second function for adding data to a file ( not sure why you used both fstream.h and stdio.h for file input / output in the same program ( ? ) ) seems to have some problems. First I would allocate an array of the proper size and use strcpy ( string.h ) to copy the data.

Next , you should take read() and write() out of the conditional or the program will never end :

thats what I see so far…..