阅读背景:

如何避免使用C中非空终止的缓冲区调用fopen()?

来源:互联网 

Let's look at this example:

我们来看看这个例子:

static FILE *open_file(const char *file_path)
{
    char buf[80];
    size_t n = snprintf(buf, sizeof (buf), "%s", file_path);
    assert(n < sizeof (buf));
    return fopen(buf, "r");
}
stat



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: