Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change purpose

Status
Not open for further replies.

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 .
 
#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( &quot;Enter in a string<TAB to end>:&quot; );
cTemp=getch();

while( cTemp!=END_OF_STRING )
{
if( cTemp==RETURN_KEY )
cTemp=NEW_LINE;

printf( &quot;%c&quot;,cTemp );
sHoldString[iLoopControl++]=cTemp;
cTemp=getch();
if( iLoopControl==SIZE_OF_STRING ) break;
}

sHoldString[iLoopControl]='\0';
printf( &quot;\nYou typed: %s\n&quot;,sHoldString );

return 0;
}
Mike L.G.
mlg400@blazemail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top