avatar
文章
59
标签
84
分类
15
Home
Archives
Tags
Categories
Link
About
Logo小土坡的博客
搜索
Home
Archives
Tags
Categories
Link
About

小土坡的博客

Rust 简单输入输出以及读取文件 - 例子代码
发表于2024-02-21|编程
在这里分享一个我写的 Rust 例子,用到了输入输出和文件读取。 123456789101112131415161718192021222324252627/// # 学习 Rust 中的标准输入/// 首先我们要导入 stdin/// `use std::io::stdin`use std::io::{self, stdin};use std::io::prelude::*;use std::fs::File;fn main() -> io::Result<()> { println!("请输入一些内容个 hello 变量:"); let mut hello = String::new(); stdin().read_line(&mut hello)?; // 程序运行到这里会停住等你输入文字 // 打印 hello 变量 println!("variable hello>>>: {hello}"); //...
C语言字符串处理相关笔记
发表于2024-02-13|编程
gets()函数原型: 1char * gets (char *__str); 功能:从标准输入读入字符,并保存到__str指定的内存空间,直到出现换行符或读到文件结尾为止。 参数:s 字符串首地址。返回值: 成功:读入的字符串。 失败:NULL 例子: 1234567void string_test(void){ char s[100]; if (gets(s) != NULL) { printf("%s\n", s); }} 调用该函数会提示警告是危险的函数,可以使用 fgets()。 1call to 'gets' declared with attribute warning: Using gets() is always unsafe - use fgets() fgets()头文件:#include<stdio.h> 函数原型: 1char * fgets (char *__restrict__ __s, int __n,...
C语言宏笔记详情
发表于2024-02-05|编程
宏是C语言中的基石,写 c 程序就必定会用的宏,所有学习宏也是必不可少的。 宏的分类(使用方式): 简单的宏定义(只有宏名):#define DEBUG 简单替换:#define PI 3.1415926 带参数的宏: #define ADD(x,y) ((x) + (y)) // 加法运算 #define SQRT(x) ((x) * (x)) // 平方运算 do {} while(0) 语法在 C 语言 中,使用 do…while 结构来定义宏时,通常是为了确保宏定义中的代码块在使用时可以像一个独立的语句一样被执行。do…while 结构的基本语法如下: 1234#define MACRO_NAME (arguments...)do { /* 宏定义 */} while (0) 1234567891011#include <stdio.h>// 定义一个简单的宏#define PRIVATE_MESSAGE(msg) do {\ ...
C语言动态数组的实现
发表于2024-02-05
12345678910struct Dyn_arry_t{ int* array; int capacity; int size;};void dyn_array_test(void);struct Dyn_arry_t dyn_array_init(int* array, int size); 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081#include "dyn_array.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include "utils.h"/** * @brief 初始化动态数组 * @param array :要初始化的数组 *...
C语言中打印整型数组的函数实现
发表于2024-02-05|编程
在这里分享出自己写的,用于打印整型数组的C函数,把函数写到了 utils 文件中,以后可以往里边写一下其他的工具函数。 utils.h12345678910#ifndef _UTILS_H#define _UTILS_H#include <stdio.h>#define Line(message) printf("-------------------- %s --------------------\n", message)void print_array_int(int* arr, int size);#endif /* _UTILS_H */ utils.c12345678910111213141516171819#include "utils.h"#include <stdio.h>void print_array_int(int* arr, int size){ for(int i = 0; i < size; i++) { if (i ==...
LTspice 界面相关翻译
发表于2024-02-04|电路设计
编辑仿真命令对话框瞬态分析 交流分析 直流扫描 噪声分析 直流转换 直流静态工作点 瞬态频率响应分析
FreeRTOS LED闪烁例子
发表于2024-01-30|嵌入式
这个例子演示了基于 FreeRTOS 的闪灯程序,这里给出主要代码块。 main.c12345678910void vApplicationTickHook(void){ global_num_1++; if (global_num_1 >= 500) { global_num_1 = 0; // 给 led_task 任务发送通知 xTaskNotifyGive(xTaskGetHandle("led_task")); }} led.c123456789101112/// @brief led FreeRTOS 任务函数/// @param pvParametersvoid led_task(void *pvParameters){ uint32_t ul_notify_value; while (1) { ul_notify_value = ulTaskNotifyTake(pdTRUE, 0); if...
我的Vim配置文件
发表于2024-01-13|编程
我的配置文件如下: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137call plug#begin()" The default plugin directory will be as follows:" - Vim (Linux/macOS): '~/.vim/plugged'" - Vim (Windows):...
CMake 笔记
发表于2024-01-12|编程
1…56
avatar
小土坡
小土坡是一个关于电子技术与软件设计的博客站点,会经常写一下学习笔记和分享一些其他内容。
文章
59
标签
84
分类
15
Follow Me
公告
This is my Blog
最新文章
linux tree command
linux tree command2025-03-27
React 更新 state 中的数组
React 更新 state 中的数组2025-03-23
Mui 中的 Divider 分割线
Mui 中的 Divider 分割线2025-03-20
Autocomplete 中的两个可控状态 value 和 inputValue
Autocomplete 中的两个可控状态 value 和 inputValue2025-03-20
Autocomplete 练习,各个属性的例子
Autocomplete 练习,各个属性的例子2025-03-19
分类
  • Docker1
  • Issues1
  • Linux2
  • Mui5
  • React3
  • Rust1
  • Tauri2
  • TypeScript2
标签
按键长按 theme 裸机 FreeRTOS array clang-format React库 流程图 KiCad 字符串 disablePortal javascript LTspice sqlite CMake FreeRTOSConfig 唯一ID AT32 Paper 中断 Mui sql OLED Tauri Docker Autocomplete 开源项目 mui Array NVIC 前端 滴答定时器 TM3608 二极管 遍历 react 组件 Rust 宏 Blog
归档
  • 三月 2025 13
  • 一月 2025 1
  • 十二月 2024 14
  • 十一月 2024 3
  • 七月 2024 1
  • 六月 2024 3
  • 三月 2024 8
  • 二月 2024 13
网站信息
文章数目 :
59
本站访客数 :
本站总浏览量 :
最后更新时间 :
©2023 - 2025 By 小土坡
框架 Hexo|主题 Butterfly
搜索
数据加载中