网站收款即时到账怎么做的/东莞seo网络培训

网站收款即时到账怎么做的,东莞seo网络培训,网站建设一般需要什么功能,平面设计公司简介模板//以目录枚举为例子&#xff0c;说明enumerator&#xff0c;从源码剥离可运行 #include <stdio.h> #include <stdbool.h> #include <dirent.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h&…

//以目录枚举为例子,说明enumerator,从源码剥离可运行

#include <stdio.h>
#include <stdbool.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <sys/time.h>
#include <stdarg.h>/*** This macro allows counting the number of arguments passed to a macro.* Combined with the VA_ARGS_DISPATCH() macro this can be used to implement* macro overloading based on the number of arguments.* 0 to 10 arguments are currently supported.*/
#define VA_ARGS_NUM(...) _VA_ARGS_NUM(0,##__VA_ARGS__,10,9,8,7,6,5,4,3,2,1,0)
#define _VA_ARGS_NUM(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NUM,...) NUM/*** This macro can be used to dispatch a macro call based on the number of given* arguments, for instance:** @code* #define MY_MACRO(...) VA_ARGS_DISPATCH(MY_MACRO, __VA_ARGS__)(__VA_ARGS__)* #define MY_MACRO1(arg) one_arg(arg)* #define MY_MACRO2(arg1,arg2) two_args(arg1,arg2)* @endcode** MY_MACRO() can now be called with either one or two arguments, which will* resolve to one_arg(arg) or two_args(arg1,arg2), respectively.*/
#define VA_ARGS_DISPATCH(func, ...) _VA_ARGS_DISPATCH(func, VA_ARGS_NUM(__VA_ARGS__))
#define _VA_ARGS_DISPATCH(func, num) __VA_ARGS_DISPATCH(func, num)
#define __VA_ARGS_DISPATCH(func, num) func ## num/*** Assign variadic arguments to the given variables.** @note The order and types of the variables are significant and must match the* variadic arguments passed to the function that calls this macro exactly.** @param last		the last argument before ... in the function that calls this* @param ...		variable names*/
#define VA_ARGS_GET(last, ...) ({ \va_list _va_args_get_ap; \va_start(_va_args_get_ap, last); \_VA_ARGS_GET_ASGN(__VA_ARGS__) \va_end(_va_args_get_ap); \
})/*** Assign variadic arguments from a va_list to the given variables.** @note The order and types of the variables are significant and must match the* variadic arguments passed to the function that calls this macro exactly.** @param list		the va_list variable in the function that calls this* @param ...		variable names*/
#define VA_ARGS_VGET(list, ...) ({ \va_list _va_args_get_ap; \va_copy(_va_args_get_ap, list); \_VA_ARGS_GET_ASGN(__VA_ARGS__) \va_end(_va_args_get_ap); \
})#define _VA_ARGS_GET_ASGN(...) VA_ARGS_DISPATCH(_VA_ARGS_GET_ASGN, __VA_ARGS__)(__VA_ARGS__)
#define _VA_ARGS_GET_ASGN1(v1) __VA_ARGS_GET_ASGN(v1)
#define _VA_ARGS_GET_ASGN2(v1,v2) __VA_ARGS_GET_ASGN(v1) __VA_ARGS_GET_ASGN(v2)
#define _VA_ARGS_GET_ASGN3(v1,v2,v3) __VA_ARGS_GET_ASGN(v1) __VA_ARGS_GET_ASGN(v2) \__VA_ARGS_GET_ASGN(v3)
#define _VA_ARGS_GET_ASGN4(v1,v2,v3,v4) __VA_ARGS_GET_ASGN(v1) __VA_ARGS_GET_ASGN(v2) \__VA_ARGS_GET_ASGN(v3) __VA_ARGS_GET_ASGN(v4)
#define _VA_ARGS_GET_ASGN5(v1,v2,v3,v4,v5) __VA_ARGS_GET_ASGN(v1) __VA_ARGS_GET_ASGN(v2) \__VA_ARGS_GET_ASGN(v3) __VA_ARGS_GET_ASGN(v4) __VA_ARGS_GET_ASGN(v5)
#define __VA_ARGS_GET_ASGN(v) v = va_arg(_va_args_get_ap, typeof(v));#ifndef FALSE
# define FALSE false
#endif /* FALSE */
#ifndef TRUE
# define TRUE  true
#endif /* TRUE */typedef struct enumerator_t enumerator_t;struct enumerator_t {/*** 枚举集合。** enumerate() 方法接受可变数量的指针参数(枚举到的值被写入这些参数)**通常只需分配调用枚举器的 venumerate() 方法的通用 enumerator_enumerate_default() 函数就足够了。 ...** @param ...	枚举项的变量列表,取决于实现* @return		TRUE if pointers returned*/bool (*enumerate)(enumerator_t *this, ...);/*** 枚举集合。** venumerate() 方法采用一个变量参数列表,其中包含将枚举值写入的指针。** @param args	枚举项的变量列表,取决于实现* @return		TRUE if pointers returned*/bool (*venumerate)(enumerator_t *this, va_list args);/*** Destroy an enumerator_t instance.*/void (*destroy)(enumerator_t *this);
};/*** Enumerator implementation for directory enumerator*/
typedef struct {/** implements enumerator_t */enumerator_t public;/** directory handle */DIR *dir;/** absolute path of current file */char full[PATH_MAX];/** where directory part of full ends and relative file gets written *///完整路径中的目录部分结束以及相对文件将被写入的位置char *full_end;
} dir_enum_t;
/*** Helper function that compares two strings for equality*/
static inline bool streq(const char *x, const char *y)
{return (x == y) || (x && y && strcmp(x, y) == 0);
}bool enumerate_dir_enum(dir_enum_t *this, va_list args){//读取目录中的条目,依靠此函数特性实现枚举struct dirent *entry = readdir(this->dir);struct stat *st = NULL;size_t remaining;char **relative = NULL, **absolute = NULL;;int len;//对应enumerate输入的变参... &relative, &file, NULL 下面写入这些值相当于写入那些值VA_ARGS_VGET(args, relative, absolute, st);if (!entry){return FALSE;}if (streq(entry->d_name, ".") || streq(entry->d_name, "..")){return this->public.enumerate(&this->public, relative, absolute, st);}if (relative){//条目名称*relative = entry->d_name;}if (absolute || st){//full是路径,relativeremaining = sizeof(this->full) - (this->full_end - this->full);len = snprintf(this->full_end, remaining, "%s", entry->d_name);if (len < 0 || len >= remaining){return FALSE;}if (absolute){*absolute = this->full;}if (st && stat(this->full, st)){/* try lstat() e.g. if a symlink is not valid anymore */if ((errno != ENOENT && errno != ENOTDIR) || lstat(this->full, st)){return FALSE;}}}return TRUE;
}# define DIRECTORY_SEPARATOR "/"
static inline bool path_is_separator(char c)
{return c == DIRECTORY_SEPARATOR[0];
}/*** Object allocation/initialization macro, using designated initializer.*/
#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \*(this) = (typeof(*(this))){ __VA_ARGS__ }; (this); })bool enumerator_enumerate_default(enumerator_t *enumerator, ...)
{va_list args;bool result;if (!enumerator->venumerate){return FALSE;}//va_start用于获取函数参数列表...中可变参数的首指针//输出参数args保存函数参数列表中可变参数的首指针(即,可变参数列表)//输入参数enumerator为函数参数列表中最后一个固定参数(...之前)va_start(args, enumerator);result = enumerator->venumerate(enumerator, args);va_end(args);return result;
}void destroy_dir_enum(dir_enum_t *this){closedir(this->dir);free(this);
}enumerator_t* enumerator_create_directory(const char *path)
{dir_enum_t *this;int len;//实例化INIT(this,.public = {.enumerate = enumerator_enumerate_default,.venumerate = enumerate_dir_enum,.destroy = destroy_dir_enum,},);if (*path == '\0'){path = "./";}len = snprintf(this->full, sizeof(this->full)-1, "%s", path);if (len < 0 || len >= sizeof(this->full)-1){free(this);return NULL;}/* append a '/' if not already done */if (!path_is_separator(this->full[len-1])){this->full[len++] = DIRECTORY_SEPARATOR[0];this->full[len] = '\0';}this->full_end = &this->full[len];//打开目录this->dir = opendir(path);if (!this->dir){free(this);return NULL;}return &this->public;
}int main()
{char *file;char *relative;char *st;char *path = "/root/open/strongswan-6.0.0";enumerator_t *enumerator;enumerator = enumerator_create_directory(path);if (enumerator){while (enumerator->enumerate(enumerator, &relative, &file, NULL)){printf("file: %s | relative: %s | size:%s\n", file, relative, NULL);}enumerator->destroy(enumerator);}return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/73685.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Hugging Face 开源库】Diffusers 库 —— 扩散模型

Diffusers 的三个主要组件1. DiffusionPipeline&#xff1a;端到端推理工具__call__ 函数callback_on_step_end 管道回调函数 2. 预训练模型架构和模块UNetVAE&#xff08;Variational AutoEncoder&#xff09;图像尺寸与 UNet 和 VAE 的关系EMA&#xff08;Exponential Moving…

甘肃旅游服务平台+论文源码视频演示

4 系统设计 4.1系统概要设计 甘肃旅游服务平台并没有使用C/S结构&#xff0c;而是基于网络浏览器的方式去访问服务器&#xff0c;进而获取需要的数据信息&#xff0c;这种依靠浏览器进行数据访问的模式就是现在用得比较广泛的适用于广域网并且没有网速限制要求的小程序结构&am…

路由选型终极对决:直连/静态/动态三大类型+华为华三思科配置差异,一张表彻底讲透!

路由选型终极对决&#xff1a;直连/静态/动态三大类型华为华三思科配置差异&#xff0c;一张表彻底讲透&#xff01; 一、路由&#xff1a;互联网世界的导航系统二、路由类型深度解析三者的本质区别 三、 解密路由表——网络设备的GPS华为&#xff08;Huawei&#xff09;华三&a…

【RAG综述系列】之 RAG 相关背景和基本原理

系列文章&#xff1a; 【RAG综述系列】之 RAG 相关背景和基本原理 【RAG综述系列】之 RAG 特点与挑战以及方法与评估 【RAG综述系列】之 RAG 先进方法与综合评估 【RAG综述系列】之 RAG 应用和未来方向 正文&#xff1a; 检索增强生成&#xff08;Retrieval-Augmented Gen…

CMake 构建的Qt 项目中的构建套件的配置

在Qt 框架中&#xff0c;使用CMake 构建工具时&#xff0c;需要自己给构建套件添加相关配置&#xff0c;否则已经添加的构建套件将不可选择使用。 创建CMake 项目后&#xff0c;如果打开项目配置时&#xff0c;出现如下构建套件不可选的情况&#xff0c; 需要先确认是否安装…

UE4学习笔记 FPS游戏制作26 UE中的UI

文章目录 几个概念创建一个UI蓝图添加UI获取UI的引用 切换设计器和UI蓝图将UI添加到游戏场景锚点轴点slotSizeToContent三种UI数据更新方式函数绑定属性绑定事件绑定 九宫格分割图片 几个概念 UMG&#xff1a;UE的UI编辑器 slate UI: UE的UI的编辑语言 创建一个UI蓝图 右键用…

头条项目的文章延迟发布功能

最近做的头条项目其中有个功能是创作者发表的文章可以设置在未来某个时间发表&#xff0c;在实现这个功能的时候就在想该怎么实现呢&#xff1f;刚开始想的是利用Spring的定时任务定时的去数据库中查询&#xff0c;可以这个查询频率该怎么设置&#xff0c;每次从数据库中需要查…

Celery 全面指南:Python 分布式任务队列详解

Celery 全面指南&#xff1a;Python 分布式任务队列详解 Celery 是一个强大的分布式任务队列/异步任务队列系统&#xff0c;基于分布式消息传递&#xff0c;专注于实时处理&#xff0c;同时也支持任务调度。本文将全面介绍 Celery 的核心功能、应用场景&#xff0c;并通过丰富…

OpenHarmony NativeC++应用开发speexdsp噪声消除案例

随着5.0的版本的迭代升级&#xff0c;笔者感受到了开源鸿蒙前所未有大的版本更替速度。5.0出现了越来越多的C API可以调用&#xff0c;极大的方便了native c应用的开发。笔者先将speexdsp噪声消除的案例分享&#xff0c;老规矩&#xff0c;还是开源&#xff01;&#xff01;&am…

【机器学习】什么是决策树?

什么是决策树&#xff1f; 决策树是一种用于分类和回归问题的模型。它通过一系列的“决策”将数据逐步分裂&#xff0c;最终得出预测结果。可以把它看作是一个“树”&#xff0c;每个节点表示一个特征的判断&#xff0c;而每个分支代表了可能的判断结果&#xff0c;最终的叶子…

CentOS 7安装 mysql

CentOS 7安装 mysql 1. yum 安装 mysql 配置mysql源 yum -y install mysql57-community-release-el7-10.noarch.rpm安装MySQL服务器 yum -y install mysql-community-server启动MySQL systemctl start mysqld.service查看MySQL运行状态&#xff0c;运行状态如图&#xff…

docker安装,镜像,常用命令,Docker容器卷,Docker应用部署,自定义镜像,Docker服务编排,创建私有仓库

1.为什么使用docker 如果开发环境和测试环境的允许软件版本不一致&#xff0c;可能会导致项目无法正常启动 把环境和项目一起打包发送给测试环境 1.1docker的概念 开源的应用容器引擎&#xff0c;完全使用沙箱机制&#xff0c;相互隔离&#xff0c;容器性能开销极低 一种容…

Manus的开源替代者之一:OpenManus通用AI智能体框架解析及产品试用

引言 在AI智能体领域&#xff0c;Monica团队近期发布的Manus被誉为全球首个通用型AI智能体。该项目推出后迅速爆红&#xff0c;邀请码一号难求&#xff0c;随之而来的是各路开发者快速构建了众多类似的开源替代方案。其中&#xff0c;MetaGPT团队的5位工程师仅用3小时就开发完…

HDR(HDR10/ HLG),SDR

以下是HDR&#xff08;HDR10/HLG&#xff09;和SDR的详细解释&#xff1a; 1. SDR&#xff08;Standard Dynamic Range&#xff0c;标准动态范围&#xff09; • 定义&#xff1a;SDR是传统的动态范围标准&#xff0c;主要用于8位色深的视频显示&#xff0c;动态范围较窄&…

uni-app页面怎么设计更美观

顶部 页面最顶部要获取到手机设备状态栏的高度&#xff0c;避免与状态栏重叠或者被状态栏挡住 // 这是最顶部的父级容器 <view :style"{ paddingTop: ${statusBarHeight extraPadding}px }">.... </view> export default {data() {return {statusBarH…

江西核威环保科技:打造世界前沿的固液分离设备高新企业

随着市场经济的不断发展&#xff0c;消费者的需求越来越大&#xff0c;为了更好的服务广大新老客户&#xff0c;作为知名品牌的“江西核威环保科技有限公司&#xff08;以下简称江西核威环保科技&#xff09;”&#xff0c;将坚持以“服务为企业宗旨&#xff0c;全力打造世界前…

PTA 1097-矩阵行平移

给定一个&#x1d45b;&#x1d45b;nn的整数矩阵。对任一给定的正整数&#x1d458;<&#x1d45b;k<n&#xff0c;我们将矩阵的奇数行的元素整体向右依次平移1、……、&#x1d458;、1、……、&#x1d458;、……1、……、k、1、……、k、……个位置&#xff0c;平移…

C++蓝桥杯实训篇(一)

片头 嗨~小伙伴们&#xff0c;大家好&#xff01;现在我们来到实训篇啦~本篇章涉及算法知识&#xff0c;比基础篇稍微难一点&#xff0c;我会尽量把习题讲的通俗易懂。准备好了吗&#xff1f;咱们开始咯&#xff01; 第1题 递归实现指数型枚举 我们先画个图~ 从图中&#xff…

CentOS(最小化)安装之后,快速搭建Docker环境

本文以VMware虚拟机中安装最小化centos完成后开始。 1. 检查网络 打开网卡/启用网卡 执行命令ip a查看当前的网络连接是否正常&#xff1a; 如果得到的结果和我一样&#xff0c;有ens网卡但是没有ip地址&#xff0c;说明网卡未打开 手动启用&#xff1a; nmcli device sta…

软考《信息系统运行管理员》- 5.3 信息系统数据资源备份

文章目录 数据资源备份类型按数据备份模式分按备份过程中是否可接收用户响应和数据更新分按数据备份策略分按备份的实现方式分按数据备份的存储方式分 常用备份相关技术磁盘阵列技术双机热备 某公司数据备份管理制度实例 数据资源备份类型 数据备份系统由硬件和软件两部分组成…