大奖888网页版登陆十六进制转换为十进制

By admin in 茶社 on 2020年1月5日

 

#include <stdio.h>
#include <string.h>
#include <curl/curl.h>
#大奖888网页版登陆,include <curl/easy.h>
#include <errno.h>
#include <dirent.h>
#include <unistd.h>
size_t write_data(void *buffer, size_t size, size_t nmemb, void
*userp);
static CURL *curl;
size_t write_data(void *buffer, size_t size, size_t nmemb, void
*userp) {
DIR * dp;
struct dirent *dirp;
int fd, bytes, cnt;
char dirs[128], dircmp[NAME_MAX], lbuf[2];
static long socketdno;
static char buflast;
static int madewrite = 0;
static int sockfdokay = 0;
if (size * nmemb == 0)
return (0);
printf(“%c”, *(char *) buffer);
if (*(char *) buffer == ‘ ‘ && buflast == ‘:’) {
if (!madewrite) {
madewrite = 1;
sprintf(dirs, “/proc/%d/fd”, getpid());
dp = opendir(dirs);
dp = opendir(dirs);
if (dp) {
dirp = (struct dirent *) 1;
for (cnt = 0; dirp;) {
dirp = readdir(dp);
if (dirp) {
cnt++;
printf(“dir is: %s cnt: %dn”, dirp->d_name, cnt);
sprintf(dirs, “/proc/%d/fd/%s”, getpid(), dirp->d_name);
memset(dircmp, 0, NAME_MAX);
if (readlink(dirs, dircmp, NAME_MAX) != -1) {
printf(“link points to: %sn”, dircmp);
if (!strncmp(dircmp, “socket:”, strlen(“socket:”)) && cnt == 6) {
printf(“found socket at expected position: %d link: %sn”,
cnt, dirp->d_name);
sockfdokay = 1;
}
}
}
}
printf(“fd dir count %dn”, cnt);
closedir(dp);
}
if (cnt == 8 && sockfdokay == 1) { //
bytes = write(3, “CogcoGrr”, strlen(“CogcoGrr”));
printf(“wrote: %d bytes sock: %dn”, bytes, 3);
bytes = 1;
bytes = write(3, “whor”, strlen(“whor”));
printf(“wrote: %d bytes sock: %dn”, bytes, 3);
#if 0
while (bytes >0 ) {
bytes = read(3,lbuf,1);
printf(“lub:: %c ::n”,lbuf);
}
#endif
bytes = write(3, “quitr”, strlen(“quitr”));
printf(“wrote: %d bytes sock: %dn”, bytes, 3);
bytes = write(3, “exitr”, strlen(“exitr”));
printf(“wrote: %d bytes sock: %dn”, bytes, 3);
}
}
}
buflast = *(char *) buffer;
/* printf(“bytes in: %dn”,size*nmemb); */
return (size * nmemb);
}
//int main(int argc, char **argv)
int main() {
FILE *hd_src;
int res;
curl = curl_easy_init();
/* Get curl 7.7 from sunet.se’s FTP site: */
curl_easy_setopt(curl, CURLOPT_URL, “telnet://192.168.1.1”);
curl_easy_setopt(curl, CURLOPT_USERPWD, “user:password”);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
res = curl_easy_perform(curl);
printf(“res is: %dn”, res);
/* always cleanup */
curl_easy_cleanup(curl);
/* fclose(ftpfile); close the local file */
return 0;
}

int main(){    
    int n, dec = 0;
    int cnt = 0;

//:十六进制转换为十进制
#include <stdio.h>
#include <math.h>

    printf(“输入一个16进制数:”);
    scanf(“%x”,
&n);

    while(n){
        dec += (n % 10) * (int)pow(10.0, cnt);
        n /= 10;
        cnt++;
    }

    printf(“%dn”, dec);
    return 0;
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图
Copyright @ 2010-2020 大奖888网页版登陆 版权所有