What is a Text File?
For simplicity, I'm not considering Unicode in this tutorial. We're staying in the 7 bit world of ASCII so the highest character code is 127. A text file is a file that holds ASCII characters organised in multiple length lines separated by a line break. ASCII character includes- 0x7 (bell)
- 0x8 (backspace)
- 0x9 (tab)
- 0xa (line feed)
- 0xc (Form Feed) Not used so much nowadays
- 0xd (carriage return)
- All characters in the range 0x20 (space) through to 0x7f.
// ex1.c
#include <stdio.h>
int main(int argc, char * argv[])
{
int i;
char c;
for (i=0x20;i<0x80;i++)
{
c = i;
printf("Char %d = %c\n\r",i,c) ;
if (((i+1) % 16)==0)
printf("\n\r") ;
}
return 0;
}
On the next page : Structure of Text Files

