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
#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