编程笔记

  • 关于堆栈:简单的 C 代码错误

    Simple C Code Error 有谁知道为什么我在运行这段代码时会出现段错误? Valgrind 告诉我,我在第 13 行 if( !isdigit(x) ) 上有"大小为 4 的未初始化值",并且在同一行上有一个无效的读取大小 2 - 地址不是堆栈//'d…

    编程笔记 2022年6月21日
  • 关于 c:printf 格式字符串 lint 警告

    printf format string lint warning 我一直在修复古老的代码,这是今天的问题: 12 output_file_status = fprintf ( data_file,"%03d%08s%+014.2f%06.3f%",     LongValue, CharStarValue,…

    编程笔记 2022年6月21日
  • 关于C#:缓冲区溢出的编译器艺术

    The Art of Compiler on Buffer Overflow 现代编译器GCC非常强大,它甚至可以在编译阶段防止缓冲区溢出,使操作系统无法在堆栈空间上运行代码。 例如: 1234567891011121314151617 void function(char *str)…

    编程笔记 2022年6月21日
  • 关于 c:我应该读/写多少字节到一个套接字?

    How many bytes should I read/write to a socket? 我对在 Unix 上通过 C 中的套接字写入/读取的字节数有些疑问。我习惯发送 1024 字节,但有时当我发送短字符串时,这真的太多了。 我从一个文件中读取一个字符串,…

    编程笔记 2022年6月21日
  • 关于C#:为什么默认堆栈大小为0

    why is default stack size 0 我正在阅读来自 https://computing.llnl.gov/tutorials/pthreads/ 的 pthreads,它说 Default thread stack size varies greatly. The maximum size that can be obtained also varies…

    编程笔记 2022年6月21日
  • 关于 c:Swapping 2 Bytes of Integer

    Swapping 2 Bytes of Integer 我有一个接收 3 个参数的方法:int x、int n 和 int m。它返回一个 int,其中 x 的第 n 个和第 m 个字节已交换 x 只是一个普通整数,设置为任何值。 n 和 m 是 0 到 3 之间的整数。 例…

    编程笔记 2022年6月21日
  • 关于C#:为什么scanf把字符串放到char数组中,直接输入不行?

    Why does scanf put a string into a char array while directly inputting it does not work? 这个问题很难命名。 基本上我有一个具有自己结构的数组。 1234567891011121314 typedef struct Video {   &…

    编程笔记 2022年6月21日
  • 关于C#:创建一个整数数组并以空格结尾

    Creating an Integer Array and terminating with a blank 我正在编写一个程序,该程序涉及一次请求用户输入一个随机数量的整数,该输入在用户返回空白后终止。然后将这些整数放入一个数组中,稍后我将使用该数组对…

    编程笔记 2022年6月21日
  • 关于 c:Macro 重定义警告

    Macro Redefined Warning 我正在编写这段代码,当我尝试编译时出现警告。 123456789101112131415161718192021222324252627282930313233343536373839404142 #include <stdio.h> #include <math.h> #defi…

    编程笔记 2022年6月21日
  • 关于C#:你能静态编译一个cygwin应用程序吗?

    Can you statically compile a cygwin application? cygwin 是否允许静态编译的二进制文件?这将防止 cygwin1.dll 出现在目标机器的 PATH 上。 不,目前无法静态链接到 cygwin1.dll;如果您的应用程序不使用 unix …

    编程笔记 2022年6月21日