開啟消失的休眠選項
1. 命令提示字元(系統管理員)
2. C:\WINDOWS\system32>powercfg /H on
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char **argv) { const char * const str = "MAC-:AA-BB-CC-DD-EE-FF"; const char * const delimitation = "-:"; char * const dupstr = strdup(str); char *saveptr = NULL, *substr = NULL; int i = 0; printf("original: %s (%p)\n", dupstr, dupstr); substr = strtok_r(dupstr, delimitation, &saveptr); do { printf("#%d after parsing: %s (%p)\n", i++, substr, substr); substr = strtok_r(NULL, delimitation, &saveptr); } while (substr); } /* [Result] original: MAC-:AA-BB-CC-DD-EE-FF (0x55f73e1e42a0) #0 after parsing: MAC (0x55f73e1e42a0) #1 after parsing: AA (0x55f73e1e42a5) #2 after parsing: BB (0x55f73e1e42a8) #3 after parsing: CC (0x55f73e1e42ab) #4 after parsing: DD (0x55f73e1e42ae) #5 after parsing: EE (0x55f73e1e42b1) #6 after parsing: FF (0x55f73e1e42b4) */
#include <stdio.h> #include <string.h> #include <stdlib.h> int main() { int day, year; char weekday[20], month[20], tmp[100]; strcpy(tmp, "Saturday March aaa 25 1999"); /*"%*s" means ignore aaa*/ sscanf(tmp, "%s %s %*s %d %d", weekday, month, &day, &year); printf("%s %d %d %s", month, day, year, weekday); return(0); } /* [Result] March 25 1999 Saturday */
CONFIG_PACKAGE_libssh=y CONFIG_PACKAGE_libssh2=y
printf("\033[1;31m%s = %s\033[0m\n", key, value); printk("\033[1;31m%s = %d\033[0m\n", key, value);僅linux可用
#include <stdio.h> #include <stdlib.h> int main(void) { FILE *fPtr; int age = 20; fPtr = fopen("test.txt", "w"); if (!fPtr) { printf("open file fail\n"); return 0; } fprintf(fPtr, "I am %d years old.\n", age ); fclose(fPtr); return 0; }