在 C++ 中,fgets() 函数不起作用

In C++ the fgets() function is not working

为什么 fgets 函数不起作用? 错误:类型的 C++ 参数与类型

的参数不兼容
#include <cstdio>
using namespace std;

int main()
{
    int indis = 0;
    char *g, firma[50];

    cout << "firma adı giriniz: ";

    fgets(firma, 50, g);

    g = firma;

    while (g[indis] != NULL) {
        cout << g[indis];
        indis++;
    }
    return 0;
}

我不知道如何解决这个问题。

因为你用错了

fgets 用于从文件(或流)读取。

您没有文件(或流)。

你的意思是 fgets(firma, 50, stdin); 吗?

查阅一些文档了解您使用的函数。