The best method might be to open the directory with the opendir() API, read the entries with readdir() until the end, then close it with closedir(). At least one reason would be to process subdirectories recursively. Another reason is simply from the question — why put the entries into a file just to read them back when you can read them directly?
If the source directory is known only to contain streamfiles, and subdirectories won’t be a concern, then QShell provides an easy alternative. Use the ls utility to list each entry. The output can be redirected to a streamfile for example. Of course, then you’d need to read the streamfile. Or you could redirect to a flat file — be sure your file is created to hold the names you’ll run across.
In simple situations, I pipe the ls output into the dataq utility. Each entry becomes a data queue entry that can be received by a fairly simple program.
Choose appropriate options on the ls and dataq utilities to help format the entries with most of the info that you might need.