当前位置: 首页 > 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.lryc.cn/news/590500.html

相关文章:

  • Nginx,MD5和Knife4j
  • PHP面向对象编程:类与对象的基础概念与实践
  • Uniapp中双弹窗为什么无法显示?
  • Coze工作流无法更新问题处理
  • React+Next.js+Tailwind CSS 电商 SEO 优化
  • 2_概要设计编写提示词_AI编程专用简化版
  • 正确选择光伏方案设计软件:人力成本优化的关键一步
  • 【技术追踪】基于检测器引导的对抗性扩散攻击器实现定向假阳性合成——提升息肉检测的鲁棒性(MICCAI-2025)
  • 第五届计算机科学与区块链国际学术会议(CCSB 2025)
  • Java大厂面试实录:从电商场景到AI应用的深度技术考察
  • 【计算机网络】数据通讯第二章 - 应用层
  • CentOS网络配置与LAMP环境搭建指南
  • 【后端】.NET Core API框架搭建(6) --配置使用MongoDB
  • 用Amazon Q Developer助力Python快捷软件开发
  • nextjs+react项目如何代理本地请求解决跨域
  • LiFePO4电池的安全详解
  • 从缓存 CAS 看Kimi K2使用的MuonClip优化器
  • 工业网络协议桥接设计指南:从LIN到CAN/RS-232的毫秒级互通方案
  • DNS防护实战:用ipset自动拦截异常解析与群联AI云防护集成
  • 深入核心:理解Spring Boot的三大基石:起步依赖、自动配置与内嵌容器
  • Spring Boot 源码解析之 Logging
  • 阿里云 RabbitMQ 可观测性最佳实践
  • 神经网络常见激活函数 13-Softplus函数
  • 卷积神经网络-卷积的分类
  • 【芯片设计中的WDT IP:守护系统安全的电子警犬】
  • Spring-AI系列-AI模型API
  • 如何使用 OpenCV 打开指定摄像头
  • 【Excel】使用vlookup函数快速找出两列数据的差异项
  • OpenCV稠密光流估计的一个类cv::optflow::DenseRLOFOpticalFlow
  • 03_opencv_imwrite()函数