how to get string from a struct in C? : <p>I was curious if anyone has gone about doing this before.</p>

<p>I'm having an issue with getting a string from a struct.  What I'm trying to do is get the string from the specific struct i'm working with, then put that string into fprintf("%s", whateverstring);</p>

<pre><code>FILE* outfile = fopen("Z:\\NH\\instructions.txt","wb");
if ((dir = opendir ("Z:\\NH\\sqltesting\\")) != NULL) {// open directory and if it exists

         while ((ent = readdir (dir)) != NULL) { //while the directory isn't null
                 printf("%s\n", ent-&gt;d_name);  //I can do THIS okay

                 fprintf("%s\n",ent-&gt;d_name); //but I can't do this

                    fclose(outfile);

                                        }

                    }   
                        closedir (dir);

                //else { 
                 //
                    //           perror (""); //print error and panic
                        //     return EXIT_FAILURE; 
                    //}
            }
</code></pre>

<p>am I taking  the wrong approach here?  I was thinking about in some way using something like <code>char[80] =ent.d_name;</code>
however obviously that doesn't work.  Is there some way I can get that string from the struct and throw it into fprintf?    </p>
