#include<stdio.h>
// use line f = fopen ("test.txt", "wb"); and open the file
// in notepad: no new lines! But if you open it in visual C's editor, you see
// new lines. (\n is really two characters: one goes to the next line but
// at the same location as the line above it, and another one goes to the
// beginning of the new line).
// Now change "wb" to "w" to write in ASCII instead of binary
void main ()
{
char matn[1024];
char str[80];
int i;
FILE *f;
f = fopen ("test.txt", "w");
if (!f) {
printf("Cannot open test.txt for writing.\n");
return;
}
fprintf(f, "line 1\nthis is line 2\nand line 3\n");
fclose(f);
}