/*CharTest.c*/
#include
#include
#include
#include
int mygetch(void)
{
struct termios oldt,
newt;
int ch;
tcgetattr( STDIN_FILENO, &oldt );
newt = oldt;
newt.c_lflag &= ~( ICANON | ECHO );
tcsetattr( STDIN_FILENO, TCSANOW, &newt );
ch = getchar();
tcsetattr( STDIN_FILENO, TCSANOW, &oldt );
return ch;
}
main()
{
char ch1[10],ch2[10];
char buf[100];
int a;
char c;
int buf_len = 100;
while(1)
{
sleep(5);
gets(ch2);
printf("ch2 = %s\n",ch2);
}
while(1)
{
c = mygetch();
printf("c=0x%x",c);
}
while(1)
{
scanf("%d",&a);
getchar();
printf("haha1\n");
gets(ch1);
printf("haha2\n");
getchar();
printf("haha3\n");
}
/*
unsigned int i=0xff,j=0xFA,a=3,b=100;
short m=0x55;
unsigned short k=0x55;
char mac[20];
char tmp[80];
char line[80];
int count = 0;
FILE* fp = fopen( "dev_rev", "r" );
if(fp == NULL)
printf("open errer\n");
memset(tmp,0,80);
memset(line,0,80);
count = fread(tmp,1,80,fp);
sprintf(line,"%d.%d.%d.%d",tmp[7],tmp[6],tmp[5],tmp[4]);
printf("count = %d\n",count);
// udpsend(FRM_DEV_INFO_HW_REV,tmp,count);
printf("%s",line);
fclose( fp );
memset(mac,0,20);
sprintf(mac,"%x:%x:%x:%x:%x:%x",0x11,0x22,0x33,0x44,0x55,0x66);
printf("%s\n",mac);
a = (i<<8)+j;
printf("a=%04X\n",a);
printf("int = %d short = %d\n",sizeof(int),sizeof(unsigned short));
printf("m = 0x%04X,k = 0x%04X\n",m,k);
printf("%d,%d,%d,%d,%d,%d",'s'-'a','e'-'a','c'-'a','r'-'a','e'-'a','t'-'a');
*/
}