mirror of
https://github.com/JamesonHuang/OpenWrt_Luci_Lua.git
synced 2025-07-01 06:23:23 +00:00
add test code about c & sh
This commit is contained in:
BIN
1_3.test_code/c_test/atoi/atoi
Executable file
BIN
1_3.test_code/c_test/atoi/atoi
Executable file
Binary file not shown.
34
1_3.test_code/c_test/atoi/atoi.c
Normal file
34
1_3.test_code/c_test/atoi/atoi.c
Normal file
@ -0,0 +1,34 @@
|
||||
/*************************************************************************
|
||||
> File Name: atoi.c
|
||||
> Description:
|
||||
> Conclusion:
|
||||
> Author: rh_Jameson
|
||||
> Created Time: 2015年07月15日 星期三 22时26分47秒
|
||||
************************************************************************/
|
||||
#include<stdlib.h>
|
||||
#include<stdio.h>
|
||||
#include<time.h>
|
||||
|
||||
|
||||
char buf[50];
|
||||
|
||||
char * timestamp()
|
||||
{
|
||||
time_t time_stp;
|
||||
time ( &time_stp );
|
||||
printf("%ld\n", time_stp);
|
||||
sprintf(buf, "%d", time_stp);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//printf("timestamp: %s\n", timestamp());
|
||||
char *str = timestamp();
|
||||
int test = atoi(str);
|
||||
time_t tt = atoi(str);
|
||||
|
||||
printf("%d\n", test);
|
||||
printf("%d\n", tt);
|
||||
}
|
Reference in New Issue
Block a user