Could someone please explain the following code to me? It's not for class, more personal curiosity. Thanks in advance

while(!feof(infp)) { fgets(buf, MAXLINE, infp); fputs(buf, outfp); }

what I'm mainly curious about is the argument o feof "infp."

infp is a pointer to a FILE structure, which is returned by fopen(). The statement is actaually written incorrectly. More accurately it should be while( fgets(buf,MAXLINE,infp) != NULL) fputs(buf,outfp); There is not need for feof() because fgets() returns NULL when end-of-file is reached.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.