...

text editor in dos in TC

pikolo543
02-21-2003, 05:25 AM
how can i create a text editor in dos in turbo C, i have tryied it to this

#include<stdio.h>

main(int argc, char *argv[] ){
FILE *fp;
char ch;

if( argc != 2 ) {

printf("you forgot to enter the filename\n");
return 1;
}

if( ( fp = fopen( argv[1],"w")) == NULL ) {

printf("cannot file\n");
return 1;

}

do{
ch = getchar();

putc( ch, fp );

} while(ch != '$');

fclose(fp);
return 0;
}

but it wont satisfy me becase when i press enter i wont get back to the first characters that i have type on the screen. i want to have a dos Text editor like notepad. I am using Turbo C version 2.0, please help me


thanks

Roy Sinclair
02-21-2003, 07:20 PM
Later versions of DOS (5.0?) have a program called EDIT.COM which does that already.

pikolo543
02-21-2003, 08:26 PM
ic but i want to create my own in Turboc C, is it posible

Roy Sinclair
02-21-2003, 08:36 PM
Yes, it's possible. It's going to take a heck of a lot more code than you've got so far though, you'll need to do a lot more than just copy the text file to the screen which is all your code does so far.

pikolo543
02-21-2003, 08:41 PM
i want to try it just for practice, what was the header files needed to create it.

Roy Sinclair
02-21-2003, 09:04 PM
The header files needed? It depends, are you planning on using some windowing library? Then obviously you'll need the header files for that library. It might look simple but an editor can be a very complex bit of code.

pikolo543
02-21-2003, 09:14 PM
a edit.com version in windows 98, some like that kind of text editor.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum