Purchase Solution

External File Names

Not what you're looking for?

Ask Custom Question

Why should you not use an external file name in any place other than the open statement?

Purchase this Solution

Solution Summary

This brief document (about 850 words) answers the question of whether or not to use external file names more than once. It describes the disadvantages and explains why. While it only discusses hard-coding file names, this document will also convince you to use the good programming practice of using specific constants sparingly.

Solution Preview

This one seems a bit ambiguous. I'm not sure of the context it is asked it. Nevertheless, I will try to answer it for you the best I can.

In one sense the statement is true. If you are only considering file i/o in a computer program, then you would most likely only be using the actual file name once, and that would be in the "open" statement. Both the C and the Php programming languages, for example, require the file name in whatever open statement is being used. After that, reads, writes, closes, rewinds, seeks, and all the other commands one executes with that file would reference the file pointer generated by the open command and not the actual file name.

In that case you would not want to "use an external file name in any place other than the open statement". Even in the case I outlined above, though, you might decide it's more efficient to place the actual, external file name into a variable, perhaps at the top of the program code, to make it easier to find if it needs to be changed.

The reason I said it was a bit ambiguous, though, was that there might be other operations you want to do with that file in that ...

Purchase this Solution


Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.