我是靠谱客的博主 谦让便当,最近开发中收集的这篇文章主要介绍可怜的小猪c语言代码大全,c语言编程,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

#include int main(int argc,char **argv)

{

time_t time_now;

struct tm *curr_time = NULL;

time(&time_now);

curr_time = localtime(&time_now);

printf("time_now:[%ld]n",time_now);

printf("localtime[%d.%02d.%02d %02d:%02d:%02d]n",(1900 + curr_time->tm_year),(1 + curr_time->tm_mon),curr_time->tm_mday,curr_time->tm_hour,curr_time->tm_min,curr_time->tm_sec);

return 0;

}

[root@controller /]#

=========================================================

[root@controller /]# cat str.c

#include

#include

#include

int main()

{

char *p=NULL;

char *a="1111Gib";

p=a+(strlen(a)-3);

if(*p == 'G')

{

printf("aaaaaaaaaaaaaaa");

}

printf(p);

return 0;

}

==========================================================

int main()

{

char downflow[32]={0};

//get_results_cmd(downflow, "cat /haha.ini");

snprintf(downflow,32,"%d",0);

printf("%sn",downflow);

return 0;

}

[root@controller /]#

==============================================

[root@controller /]# cat aaa.c

#include

#include

#include

int main()

{

int a = -3;

if(a == -3)

{

printf("hahahahahhahan");

}

return 0;

}

[root@controller /]#

=======================================================

[root@controller /]# cat cc.c

#include

int main()

{

char *a="3.67";

char b[16]={0};

float f=atof(a);

printf("%lfn",f);

snprintf(b, 16,"%f",atof(a));

printf("%sn",b);

return 0;

}

[root@controller /]#

==================================================

[root@controller /]# cat echo.c

#include

#include

#include

int main()

{

char temp1[128];

bzero(&temp1, sizeof(temp1));

snprintf(temp1, sizeof(temp1), "echo "%s        %s        %s" >> /etc/ipv6_config",  "eth0", "1.1.1.1/24", "2.2.2.2/24");

system(temp1);

return 0;

}

[root@controller /]

=====================================================

[root@controller /]# cat float.c

#include

#include

#include

int bbb(float *haha)

{

*haha=2.2;

}

int main()

{

float a=200.2;

float b=0;

b = a/atoi("2");

printf("%.1f",b);

if(b > 100)

{

b = 100;

}

//snprintf(cpuUsed, sizeof(cpuUsed), "%.1f", vcpustat_tmp);

//float b=2.1;

//float c = 0;

//float d = 0;

//c=a+b;

//if(a>100)

//{

//a=100;

printf("%.1f",b);

===========================================================

[root@controller /]# cat haha.c

#include

#include

#include

int get_vpairint_by_vpairflow(char *vpair_int, char *vpair_flow)

{

int len = 0 ;

len = strlen(vpair_flow);

char *t = &vpair_flow[len-1];

strncpy(vpair_int,vpair_flow,len-1);

if(atoi(t) == 0 )

{

strcat(vpair_int,"1");

}

else

{

strcat(vpair_int,"0");

}

return 0;

}

int main()

{

char *a="vpair1_1";

char b[32]={0};

get_vpairint_by_vpairflow(b, a);

printf("--------------------------%s",b);

return 0;

}

[root@controller /]#

===========================================================

[root@controller /]# cat hanzi.c

#include

#include

#include

#include"errorNo.h"

int main()

{

char a[512]={0};

char b[64]={0};

getErrInfoVm(2041,a,512);

snprintf(b,12,"%s",a);

printf("%s",a);

printf("%s",b);

return 0;

}

[root@controller /]#

===========================================================

//    if(vpair_name == NULL || strlen(vpair_name) == 0)

//    {

//        ret =-1;

//    }

return ret;

}

===========================================================

int main()

{

char modifySrcIp[64] = {0};

char *bufTmp= NULL;

char srcIp[64] = { 0 };

strcpy(srcIp, "169.254.255.2");

bufTmp=strchr(srcIp,'.');

strncpy(modifySrcIp,srcIp,bufTmp-srcIp);

strcat(modifySrcIp,bufTmp+1);

printf("%s",modifySrcIp);

return 0;

==========================================================

[root@controller /]# cat mac.c

#include

#include

#include

int main()

{

char mac[64]={0};

char newmac[64]={0};

char *p = NULL;

snprintf(mac,sizeof(mac),"%s","25:4a:ef:ce:24:d9");

printf("%sn",mac);

p=mac;

snprintf(newmac,sizeof(newmac),"%s%s","aa",p+2);

printf("%sn",newmac);

return 0;

}

===========================================================

最后

以上就是谦让便当为你收集整理的可怜的小猪c语言代码大全,c语言编程的全部内容,希望文章能够帮你解决可怜的小猪c语言代码大全,c语言编程所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(44)

评论列表共有 0 条评论

立即
投稿
返回
顶部