Code:
char buf[50];
fgets(buf, sizeof(buf), stdin);
..what does sizeof(buf), stdin do? What does it mean?
..and this one? I don't get this one also...
Code:
/* ... include headers ... */
. . .
void readCredentials(char *name, size_t name_maxlen, char *passcode, size_t passcode_maxlen);
void analyzeCredentials(const char *name, const char *passcode);
char readOption();
. . .
int main()
{
Code:
readCredentials(name, sizeof(name) - 1, passcode, sizeof(passcode) - 1);
...and that... what does it mean if we put -1 there?
Code:
loop:
{
char name[20] = "";
char passcode[20] = "";
readCredentials(name, sizeof(name) - 1, passcode, sizeof(passcode) - 1);
analyzeCredentials(name, passcode);
}
if (readOption() == 'R')
goto loop;
..is that the way how a while...do loop works?
what's the difference between do...while and while...do? I know that they're not the same, am I right?
How to mask the password with "*" has been asked many times and there's no standard way. If you do a search, I'm sure you will find lots of info.
I found this one from:
http://www.gohacking.com/2007/12/c-p...d-mask-it.html
I made some modification... -_+
Code:
#include<stdio.h>
#include<conio.h>
char pw[25], ch;
int i;
int main()
{
clrscr();
puts("Enter password");
while(1)
{
if(i<0)
i=0;
ch=getch();
if(ch==13)
break; /*13 is ASCII value of ENTER*/
if(ch==8) /*ASCII value of BACKSPACE*/
{
putch('\b');
putch(NULL);
putch('\b');
--i;
continue;
}
pw[i++]=ch;
ch='*';
putch(ch);
}
pw[i]='\0';
printf("\n\n%s",pw);
getch();
return 0;
}
...can someone please explain this to me? Coz, I don't still get it...
...hmmm, anyways, thank you very much to all of you who have helped me... I really appreciate it... ^.^