This page presents how to load the most common passwords in C or C++. The list can be downloaded on one from the following pages:
The following source code open the file with fopen() before reading each password with fscanf() in a loop.
The loop ends when the end of file (EOF) is reached.
The code loads the file with 100 passwords. Change the filename to load more passwords.
The following source codes can be used to load one of the files in C or C++:
FILE* stream;
char password[40];
// Opening file in reading mode
stream = fopen("100-most-common-passwords.txt", "r");
if (stream == NULL) exit(1);
// Read all password until end of file
while (fscanf(stream, "%s", password) != EOF) {
printf ("%s\n", password);
}