I fixed the hfPtr, it was the others that I thought were declared in the prototype. Its now giving me an error that says writePr is being used without having been initialized but I thought that this had initialized it.
Code:
/* create formated text for printing */
void textFile( FILE *readPtr )
{
FILE *writePtr; /* hardware.txt file pointer */
/* create hardwareData with default information */
struct hardwareData hardware = { 0, "", 0,0.0 };
/* fopen opens file; exits if file cannot be opened */
if ((hfPtr = fopen( "hardware.dat", "rb+" )) == NULL ) {
printf( "File could not be opened.\n" );
} /* end if */
else{
rewind( readPtr ); /* sets pointer to begining of file */
fprintf( writePtr, "%-6s%-10s%-8s%-8s\n",
"Record#", "Tool name", "Quantity", "Cost" );
p.s. feof is what is used in my book so thats why I used it.