How to Make a Text File

There are many kinds of files on a computer. You can see DOC files, RTF files, EXE files, GIFs, JPGs, and many others. Each of these files was created by an application which knew how to read the file and process its contents.

The simplest type of file is called a "text file". This may or may NOT have a ".txt" extension. A text file is a file that is stored with very few bytes except for the actual codes for the characters it contains. A text file created by, say, Notepad, that contains 4 words may be no more than 25 or 30 bytes (note, NOT Megabytes or Kilobytes, just bytes!). Compare that to a Microsoft Word DOC file with the same four words in it- it will be at least 20 Kilobytes. Why the difference? because Word stores a lot of extra information about the document - formatting characters, the author's name, margin settings, font settings, etc.

A programmer should be aware of what type of file he or she is creating. All these types have their uses and are NOT generally interchangeable.

Our assignments will usually say "create a text file". It may be for an input data file, it might be an output capture file, it might be a design for a program, it might be a test plan.

Hint: if you are using Windows, set the Folder Properties so that you can see the file extensions. It makes it much easier to understand!

How do you create a text file? There are several ways:

Why do we ask for text files?

In programming assignments, the files you should turn in will be listed and their types will be stated. If you don't match this, you will be asked to try again, and your assignment will not be considered turned in until you succeed in giving the formats requested.