Mar 3, 2002 #1 peyeto Programmer Mar 3, 2002 1 MY Is there any way that to change the TAB button into the ENTER button.Because i want to use the TAB instead of ENTER after i have input my data .
Is there any way that to change the TAB button into the ENTER button.Because i want to use the TAB instead of ENTER after i have input my data .
Mar 3, 2002 #2 LiquidBinary Programmer Jul 27, 2001 148 US #include <stdio.h> #include <conio.h> #define SIZE_OF_STRING 100 #define END_OF_STRING '\t' #define NEW_LINE '\n' #define RETURN_KEY 0x0D int main( void ) { char sHoldString[SIZE_OF_STRING]; char cTemp; int iLoopControl; iLoopControl=0; printf( "Enter in a string<TAB to end>:" ); cTemp=getch(); while( cTemp!=END_OF_STRING ) { if( cTemp==RETURN_KEY ) cTemp=NEW_LINE; printf( "%c",cTemp ); sHoldString[iLoopControl++]=cTemp; cTemp=getch(); if( iLoopControl==SIZE_OF_STRING ) break; } sHoldString[iLoopControl]='\0'; printf( "\nYou typed: %s\n",sHoldString ); return 0; } Mike L.G. mlg400@blazemail.com Upvote 0 Downvote
#include <stdio.h> #include <conio.h> #define SIZE_OF_STRING 100 #define END_OF_STRING '\t' #define NEW_LINE '\n' #define RETURN_KEY 0x0D int main( void ) { char sHoldString[SIZE_OF_STRING]; char cTemp; int iLoopControl; iLoopControl=0; printf( "Enter in a string<TAB to end>:" ); cTemp=getch(); while( cTemp!=END_OF_STRING ) { if( cTemp==RETURN_KEY ) cTemp=NEW_LINE; printf( "%c",cTemp ); sHoldString[iLoopControl++]=cTemp; cTemp=getch(); if( iLoopControl==SIZE_OF_STRING ) break; } sHoldString[iLoopControl]='\0'; printf( "\nYou typed: %s\n",sHoldString ); return 0; } Mike L.G. mlg400@blazemail.com