Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. password in star form

password in star form

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_14615603
    wrote on last edited by
    #1

    i want to make password in star form with this code anyone can do this? // password LOGINP: clrscr(); printf("\n\n\n\n\nUsername: its_vishuuuu"); gotoxy(x,y); printf("Login\n\n\t\t\tPassword: "); fflush(stdin);//covert char to int screen gets(pass1);//enter string check=strcmp(pass1,password1);//check password if(check!=0) { clrscr(); goto LOGINP; }

    CPalliniC D S 3 Replies Last reply
    0
    • M Member_14615603

      i want to make password in star form with this code anyone can do this? // password LOGINP: clrscr(); printf("\n\n\n\n\nUsername: its_vishuuuu"); gotoxy(x,y); printf("Login\n\n\t\t\tPassword: "); fflush(stdin);//covert char to int screen gets(pass1);//enter string check=strcmp(pass1,password1);//check password if(check!=0) { clrscr(); goto LOGINP; }

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Getting an input string without echoing it on the screen it is not a standard ANSI C feature. You should check if your system provide some non-standard way to do it, like Linux's getpass[^].

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • M Member_14615603

        i want to make password in star form with this code anyone can do this? // password LOGINP: clrscr(); printf("\n\n\n\n\nUsername: its_vishuuuu"); gotoxy(x,y); printf("Login\n\n\t\t\tPassword: "); fflush(stdin);//covert char to int screen gets(pass1);//enter string check=strcmp(pass1,password1);//check password if(check!=0) { clrscr(); goto LOGINP; }

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        You could try putting _getch() in a loop, printing a '*' for each character typed.

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

        1 Reply Last reply
        0
        • M Member_14615603

          i want to make password in star form with this code anyone can do this? // password LOGINP: clrscr(); printf("\n\n\n\n\nUsername: its_vishuuuu"); gotoxy(x,y); printf("Login\n\n\t\t\tPassword: "); fflush(stdin);//covert char to int screen gets(pass1);//enter string check=strcmp(pass1,password1);//check password if(check!=0) { clrscr(); goto LOGINP; }

          S Offline
          S Offline
          Stefan_Lang
          wrote on last edited by
          #4

          Unfortunately there is no way in standard C/C++ to do that, but I see you're already using non-standard functions anyway. As David pointed out, _getch() should do the trick:

          #include "stdio.h"
          #include "conio.h"

          int main()
          {
          char c;
          c = _getch();
          putchar('*');
          printf("\nYou entered %c\n", c);
          _getch(); // just to pause the program before closing the output console
          return 0;
          }

          If this doesn't work, refer to this thread for more advice: c++ - Capture characters from standard input without waiting for enter to be pressed - Stack Overflow[^]

          GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups