如果调用gets函数,会发现提示如下出错:
error C3861: “gets”: 找不到标识符
如果发现这个函数gets已经丢弃掉,则要采用新的函数gets_s替换,它的定义如下:
_Success_(return != 0)
_ACRTIMP char* __cdecl gets_s(
_Out_writes_z_(_Size) char* _Buffer,
_In_ rsize_t _Size
);
要使用这个函数就得多添加一个参数,就是缓冲区的长度。
把旧的代码:
gets(CharPtr(object_file_element));
替换为新的代码:
gets_s(CharPtr(object_file_element), MAX_ELEMENT_SIZE);
这样就可以编译通过了。