ufl:
You don't say how you will use the data file, once you have written to a file. Will you read the data back into the same program or into a second program?
Yes you could write out the struct as binary data to a file, using fwrite(), or if transferring data between two programs, you might want to write out the three elements of the struct as text lines using fprintf().
From hamster_nz:
The first argument to fprintf(), "f" represents the file pointer. in your code, your file pointer is "outfile".fprintf(f,"%s, %s\n", input1.fname, input1.lname)