From: Stan Moore Newsgroups: comp.os.msdos.djgpp Subject: Re: editor Date: Sat, 11 Nov 2000 10:00:14 -0500 Message-ID: References: <8ui41b$2nn$1 AT lacerta DOT tiscalinet DOT it> X-Newsreader: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: digital-4-208.exis.net X-Trace: 11 Nov 2000 09:57:22 -0500, digital-4-208.exis.net Lines: 58 Organization: A Customer of Exis Net Inc To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Sat, 11 Nov 2000 01:32:41 +0100, "abacuc" wrote: >#include >#include >#include >#include >int main() >{ > int car; > FILE *pf; > > clrscr(); > pf=fopen("prova.c","w"); > while((car=getxkey())!=K_F1) > { > putch(car); > fputc(car,pf); > } > fclose(pf); > return 0; >} I was able to reproduce your problem here. I think your problem is that you are bypassing the normal sytem handling of "return". Normally the system should handle the converting from the external or system representation of return and the internal representation. in this case teh getxkey isn't returning the typical dos system "return", it only gives you the linefeed. So I added a test for K_Return and hacked in a quick fix. #include #include #include #include int main() { int car; FILE *pf; clrscr(); pf=fopen("prova.c","w"); while((car=getxkey())!=K_F1) { if (car == K_Return) { car = '\n'; putch('\r'); } putch(car); fputc(car,pf); } fclose(pf); return 0; } Anyway, this version works here :) I added the putch('\r') to clean up the screen display.