|
![]() | 作者: letmein [letmein]
![]() |
登录 |
#include <dos.h> #include <stdio.h> #include <malloc.h> main(){ struct date * datep; struct time * timep; char * pass; FILE * fp; if((fp = fopen("d:\\login.txt","a+")) == null) { exit(0);} datep = malloc(sizeof(struct date)); timep = malloc(sizeof(struct time)); getdate(datep); gettime(timep); printf("\n%d/%d/%d", datep->da_year, datep->da_mon, datep->da_day); printf("\n%d:%d:%d.%d", timep->ti_hour, timep->ti_min, timep->ti_sec, timep->ti_hund); fseek(fp,0,2); fprintf(fp,"%d/%d/%d\t%d:%d:%d Login\n", datep->da_year, datep->da_mon, datep->da_day, timep->ti_hour, timep->ti_min, timep->ti_sec); fclose(fp); pass = malloc(20); R: printf("\n\nLogin: "); scanf("%s", pass); if ( strcmp(pass, "1381") ) { /*pass不对则循环至Login*/ printf("Password Error!"); goto R; } free(pass); free(datep); free(timep); exit(0); } |
地主 发表时间: 04-06-13 17:25 |
![]() | 回复: kert_t8 [kert_t8] ![]() |
登录 |
我也来写一段 直接加在autoexec.bat中 @echo off echo This computer was turned on at: >>login.dat date/t>>login.dat time/t>>login.dat echo ********************************>>login.dat @echo on |
B1层 发表时间: 04-06-13 21:22 |
![]() | 回复: moonsl [moonsl] ![]() |
登录 |
你们怜一下不会C的呀 这么多, 又这么深 ??????????????????????????????????????看到吐 |
B2层 发表时间: 04-06-15 13:28 |
![]() | 回复: peter [peter] ![]() |
登录 |
很不错。。 不过在 R: goto R; 这部份做的有点。。。。。一般在可以不使用 goto 的情况是不使用的(一般情况下) 因为它不合乎结构化的程序. 还有 没有计算输入的错误次数,所以可以无限次的输入。。(我也不知这样好不好) |
B3层 发表时间: 04-06-16 11:37 |
![]() | 回复: Anubis [shajia2646] ![]() |
登录 |
不错哦,我上机试试不过好象有点问题,应当细化一下! |
B4层 发表时间: 04-06-16 12:40 |
![]() | 回复: zml2236 [zml2236] ![]() |
登录 |
引用:搞错没有,“date/t;time/t”是叫你输入日期时间 [此贴被 小明(zml2236) 在 06月20日17时28分 编辑过] |
B5层 发表时间: 04-06-20 17:28 |
![]() | 回复: kert_t8 [kert_t8] ![]() |
登录 |
那你有没有试过呢?为什么不直接在cmd里面是一下呢?人有时候是会记错的,就像我一样:) 一下是我在dos界面下使用date/?>>help.txt 命令后,在help.txt中的内容 引用: 下面是我用date/t>>date.txt 后,date.txt里面现实的内容 引用: 明白了? |
B6层 发表时间: 04-06-25 09:31 |
![]() | 回复: fzqnt [fzqnt] ![]() |
登录 |
哈哈,我要研究研究啊 |
B7层 发表时间: 04-06-26 16:29 |
![]() | 回复: fzqnt [fzqnt] ![]() |
登录 |
哈哈,我要研究研究啊 |
B8层 发表时间: 04-06-26 16:29 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号