📄 pwdset.c
字号:
#include <stdio.h>
int main()
{
//find file
FILE *fp = 0;
int pass1 = 0;
int pass2 = 0;
int pass3 = 0;
int flag = -1;
fp = fopen("pwd","w");
if (fp == 0)
{
printf("can not open file--\"pwd\"!\n");
}
//set passwod
while (pass1 < 1 || pass1 > 255)
{
printf("\nplease input the first byte(1-255):");
scanf("%d",&pass1);
}//while
while (pass2 < 1 || pass2 > 255)
{
printf("\nplease input the second byte(1-255):");
scanf("%d",&pass2);
}//while
while (pass3 < 1 || pass3 > 255)
{
printf("\nplease input the third byte(1-255):");
scanf("%d",&pass3);
}//while
flag = fprintf(fp,"%x,%x,%x",pass1,pass2,pass3);
if (flag == -1)
{
printf("\nerror in writing data to file--\"pwd\"");
fclose(fp);
exit(1);
}
else
{
printf("success!");
fclose(fp);
exit(0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -