c - 如何从linux库传递c中的参数

标签 c linux parameters parameter-passing

如何在Linux中用C语言从库传递参数? 我试过这个:

library.c代码:

char test;
void GetParam()
{
  test = "Creating test string here.";
}

header.h代码

extern char test;
void GetParam(void);

程序.c代码

int main()
{
  GetParam();
  printf("%s\n", test);
}

但测试返回空。

最佳答案

char test 仅存储一个字符。如果您希望它存储字符串,请使用 char *test

PS:我是初学者;如果我错了,请纠正我。

关于c - 如何从linux库传递c中的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22141936/

相关文章:

c - 如何在 MPLAB Harmony 框架中的两个应用程序(状态机)之间交换数据?

linux - 如何使用wget下载具有最新时间戳的目录

python - 从 python struct.pack (big-endian) 转换为整数列表

c - 在c中获取单个const char *

c++ - Comeau 编译器中的未命名结构

linux - 如何在 Linux 上以编程方式获取网络接口(interface)速度?

c - 在 Linux 中,内核时间存储在内存中的什么位置?

r - 如何在 switch 语句中将向量作为参数传递

PHP ADODB & MySQL,绑定(bind)参数

java - 通用数据类型参数