![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言
咚咚姜
这个作者很懒,什么都没留下…
展开
-
Linux系统下使用C语言和系统提供的接口实现文件的另存为(拷贝粘贴)
以下内容为详细代码#include <unistd.h>#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <string.h>int main(int argc, char *argv[]){ int ret;//返回值 int fd; char buff[1024]; if(ar原创 2020-07-22 09:05:38 · 747 阅读 · 0 评论 -
C语言——mysql数据库表内容的查询
接上一篇,这里简单地示例一下查询的用法#include<stdio.h>#include<mysql/mysql.h>struct stu{ int sno; char sname[32]; char sbirth[16]; char sgender[4]; char sclass[8];};int main(){ //定义句柄 MYSQL mysql; //初始化句柄 if(NULL == mysql_init(&mysql))原创 2020-07-18 15:50:25 · 886 阅读 · 0 评论 -
用C语言连接mysql数据库,以及gcc编译命令
#include<stdio.h>#include<mysql/mysql.h>int main(){ //定义句柄 MYSQL mysql; //初始化句柄 if(NULL == mysql_init(&mysql)) { printf("mysql init error!\n"); return -1; } if(NULL == mysql_real_connect(&mysql,"localhost","root","123.原创 2020-07-17 16:50:11 · 798 阅读 · 0 评论 -
(C语言)输入n,统计0~n中1的个数。
网上有很多采用求余的手段来统计1出现的个数,这里为大家提供另一种思路解题,采用数组的方式统计。(有资源链接,免费下载,仅供学习使用)要求:输入数字n,统计0~n中1的个数,如12,1,10,11,12带1的个数5个。(假定输入的数0~999)//输入数字n统计0~n中1的个数有几个#include<stdio.h>int main(){ int n,num=0; printf("请输入数字n(0<=n<=999):"); scanf("%d",&n)原创 2020-06-14 15:07:50 · 1220 阅读 · 0 评论