home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD2.mdf
/
c
/
library
/
mslang
/
cp1
/
edstrwin.c3
< prev
next >
Wrap
Text File
|
1993-05-17
|
2KB
|
76 lines
===========================================================================
BBS: The Abacus * HST/DS * Potterville, MI
Date: 05-15-93 (13:55) Number: 162
From: GAINES WRIGHT Refer#: NONE
To: ZACH HANNA Recvd: NO
Subj: edstrwin() 3 of 3 Conf: (36) C Language
---------------------------------------------------------------------------
//continued from last message
default:
{
if(c<0) { beep(); break; } //Filter out negative chars
beep_break=0;
switch(type) //You could put all kinds of stuff here to limit input;
{ //cases like TIME, DATE, etc.
case INT:
{
if(!isdigit(c)) beep_break++;
break;
}
case FLOAT:
{
if(!isdigit(c) && c!='.') beep_break++;
if(c=='.' && strchr(string,'.')) beep_break++;
break;
}
case ONLY:
{
if(!strchr(chars_allowed,c)) beep_break++;
break;
}
default: break;
}
if(beep_break) { beep(); break; } //What else?
if(insert)
{
//Signal operator and break at max_chars
if(str_len>=max_chars) { beep(); break; }
_setcursortype(_NOCURSOR);
//Shift portion of string from cursor right one char
memmove(&string[strpos+1],&string[strpos],str_len-strpos+1);
string[strpos]=c; //Insert char
strpos++;
}
else //Overstrike mode
{
//Signal operator and break at max_chars
if(strpos>=max_chars) { beep(); break; }
//Prevent overstriking the '\0'
if(string[strpos]=='\0') string[strpos+1]='\0';
string[strpos]=c;
strpos++;
}
}
}
}
}
void main(void)
{
char buffer[81];
do {
clrscr();
buffer[0]='\0';
if(edstrwin(buffer,10,5,5,9,STRING,"")) break;
gotoxy(10,15);
cputs(buffer);
}while(getch()!=27);
}
---
■ SLMR 2.1a ■ This tagline is umop apisdn
--- DCI/Chauncy 0.7b
* Origin: Bird Lake - (813)265-3256 (1:377/14.0)
SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
SEEN-BY: 153/752 154/40 77 157/2 159/100 125 575 950 203/23 209/209 261/1023
SEEN-BY: 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20