mirror of
https://gitee.com/apaki/cmake_demo.git
synced 2025-05-17 20:01:36 +08:00
上传原始代码
This commit is contained in:
commit
a7281947d3
28
.vscode/tasks.json
vendored
Normal file
28
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++: gcc.exe 生成活动文件",
|
||||
"command": "D:\\Program Files (x86)\\TDM-GCC-64\\bin\\gcc.exe",
|
||||
"args": [
|
||||
"-fdiagnostics-color=always",
|
||||
"-g",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${fileDirname}\\${fileBasenameNoExtension}.exe"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${fileDirname}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "调试器生成的任务。"
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
10
CMakelists.txt
Normal file
10
CMakelists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
set(CMAKE_C_COMPILER "D:\\Program Files (x86)\\TDM-GCC-64\\bin\\gcc.exe")
|
||||
|
||||
|
||||
project(demo)
|
||||
|
||||
add_executable(demo main.c)
|
||||
|
104
main.c
Normal file
104
main.c
Normal file
@ -0,0 +1,104 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct list_t
|
||||
{
|
||||
uint8_t data;
|
||||
struct list_t *next;
|
||||
} list_t;
|
||||
|
||||
void list_init(struct list_t *list)
|
||||
{
|
||||
list->data = 0;
|
||||
list->next = NULL;
|
||||
}
|
||||
|
||||
void list_add(struct list_t *list, uint8_t data)
|
||||
{
|
||||
struct list_t *p = NULL;
|
||||
p = list;
|
||||
while (p->next != NULL)
|
||||
{
|
||||
p = p->next;
|
||||
if (p->data == data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
p->next = (struct list_t *)malloc(sizeof(struct list_t));
|
||||
p->next->data = data;
|
||||
p->next->next = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
void list_print(struct list_t *list)
|
||||
{
|
||||
struct list_t *p = NULL;
|
||||
p = list;
|
||||
while (p->next != NULL)
|
||||
{
|
||||
printf("%02d\n", p->data);
|
||||
p = p->next;
|
||||
if (p->next == NULL)
|
||||
{
|
||||
printf("%02d\n", p->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void list_free(struct list_t *list)
|
||||
{
|
||||
struct list_t *p = NULL;
|
||||
p = list;
|
||||
while (p->next != NULL)
|
||||
{
|
||||
p = p->next;
|
||||
free(p->next);
|
||||
p->next = NULL;
|
||||
if (p->next == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void list_demo(void)
|
||||
{
|
||||
struct list_t list;
|
||||
list_init(&list);
|
||||
for(uint32_t i = 0; i < 10; ++i)
|
||||
{
|
||||
list_add(&list, i);
|
||||
}
|
||||
list_print(&list);
|
||||
}
|
||||
|
||||
|
||||
void main(int arg, char *argv[])
|
||||
{
|
||||
#if 0
|
||||
uint32_t i = 0;
|
||||
for (i = 0; i < 10; ++i)
|
||||
{
|
||||
printf("%02d\n", i);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("Hello World!\n");
|
||||
#else
|
||||
// struct list_t list;
|
||||
// list_init(&list);
|
||||
// list_add(&list, 1);
|
||||
// list_add(&list, 2);
|
||||
// list_add(&list, 3);
|
||||
// list_add(&list, 4);
|
||||
|
||||
// list_print(&list);
|
||||
|
||||
list_demo();
|
||||
#endif
|
||||
}
|
12
test.c
Normal file
12
test.c
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
#include <openssl/aes.h>
|
||||
|
||||
bool aes_encrypt(const char *key, const char *iv, const char *input, size_t input_len, char **output)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aes_decrypt(const char *key, const char *iv, const char *input, size_t input_len, char **output)
|
||||
{
|
||||
return false;
|
||||
}
|
Loading…
Reference in New Issue
Block a user