当前位置: 首页 > news >正文

Day04_C语言网络编程20250716

01.思维导图

02

使用 sqlite3_exec 函数,执行如下几个语句
create table if no exists tb(
name text primary key,
pswd text not null
);

insert into tb(name,pswd) values("123","abcdefg")

char code_pswd[20] = ""
printf("请输入新的密码:");
scanf("%s",code_pswd)
执行语句 :update tb set pswd = code_pswd where name = "123";

#include <25051head.h>
int main(int argc, const char *argv[])
{sqlite3* db=NULL;char* err_msg=NULL;int rc=sqlite3_open("./students.db",&db);if(rc!=SQLITE_OK){fprintf(stderr,"sqlite3_open_error:%s\n",sqlite3_errmsg(db));sqlite3_close(db);return 1;}char* create_table_sql="create table if not exists tb(name text primary key,pswd text not null);";sqlite3_exec(db,create_table_sql,0,0,&err_msg);char* insert_sql="insert into tb(name,pswd) values('123','abcdefg');";sqlite3_exec(db,insert_sql,0,0,&err_msg);char code_pswd[20]="";printf("请输入新的密码:");scanf("%s",code_pswd);char update_sql[100]="";snprintf(update_sql,sizeof(update_sql),"update tb set pswd='%s' where name='123';",code_pswd);sqlite3_exec(db,update_sql,0,0,&err_msg);sqlite3_close(db);return 0;
}
#ifndef __25051HED_H__
#define __25051HED_H__                                                                                    
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
#include <sys/types.h>//引入open函数
#include <sys/stat.h>//stat lstat:
#define _GNU_SOURCE   
#include <fcntl.h> //dup3
#include <unistd.h>//引入 getdtablesize函数,获取文件描述符个数,包含close函数 dup,dup2
#include <time.h>
#include <sys/wait.h>
#include <pthread.h>//引入线程
#include <semaphore.h>//引入信号量
#include <signal.h>//引入管道通信信号
#include <sys/ipc.h>//ftok shmget
#include <sys/msg.h>//msgget
#include <sys/shm.h>//引入共享内存的
#include <sys/sem.h>//semget引入信号灯集#include <arpa/inet.h>//大端转换函数--->网络编程
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/socket.h>//引入套接字#include <sys/select.h>
#include <poll.h>
#include <sys/epoll.h>
#include <sqlite3.h>//引入sqlite3数据库                                                                                             int P(int sem_num,int sem_op,int semid);
int V(int sem_num,int sem_op,int semid);#if 0
typedef struct sockaddr_in addr_in_t;
typedef struct sockaddr addr_t;
typedef struct sockaddr_un addr_un_t;
#endif#define ERRLOG(msg) do{printf("__%d__",__LINE__);fflush(stdout);perror(msg);return -1;}while(0)  
#endif

http://www.dtcms.com/a/283323.html

相关文章:

  • 认识ETL流程:数据工程的基石
  • 暑期自学嵌入式——Day04(C语言阶段)
  • 深度学习中的注意力机制:原理、应用与实践
  • 【Linux】如何使用nano创建并编辑一个文件
  • 暑期算法训练.2
  • PHP8.5.0 Alpha 1 正式发布!
  • 1_需求规格编写提示词_AI编程专用简化版
  • 华为OD机试_2025 B卷_完美走位(Python,100分)(附详细解题思路)
  • mongodb操作巨鹿
  • 9.IEnumerable可枚举接口 C#例子 WPF例子
  • NE综合企业网络实验:从VLAN到OSPF全配置
  • MEF 在 WPF 中的简单应用
  • sky-take-out项目中的切点
  • 工控机内Docker容器间Socket通信实现
  • 继电器驱动电路注意的坑
  • AI产品经理面试宝典第30天:AI+教育个性化学习与知识图谱相关面试题的解答指导
  • 解锁支付宝小程序日活增长密码
  • 使用YOLOv11实现水果类别检测:从数据到模型训练的全过程
  • 【IDEA】格式化代码工具配置
  • 【语音技术】影视技能实现方法详细介绍
  • 基于拓扑图的故障定位系统:现代网络与电网的守护者
  • 31.Python 中初始化列表的几种方式
  • JS的防抖与节流
  • Javase总体回顾
  • EP01:【NLP 第二弹】自然语言处理概述
  • Postman接口
  • 代码随想录算法训练营第二十二天
  • AI编程神器 Claude Code 安装及使用体验
  • 横向移动(下)
  • RAG测试用例集的构造(Ragas的用法)