スポンサード リンク
Microsoft Visual C++にて以下のソースでコンパイルエラーが発生します:
コンパイルエラーメッセージ:
error C2665: '_cgets_s': 2 オーバーロードのどれも、すべての引数の型を変換できませんでしたC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt\conio.h(33): note: 'errno_t _cgets_s<256>(char (&)[256],size_t *) throw()' の可能性があります
ソース(バグ有り):
#include <stdio.h>
#include <conio.h>
int main()
{
char buf[256];
size_t read;
printf("文字を入力してください。\n");
_cgets_s(buf, sizeof(buf)** &read);
printf("入力されたバイト数: %d バイト\n", read);
return 0;
} |
ソース(修正済み):
#include <stdio.h>
#include <conio.h>
int main()
{
char buf[256];
size_t read;
printf("文字を入力してください。\n");
_cgets_s(buf, sizeof(buf), &read);
printf("入力されたバイト数: %d バイト\n", read);
return 0;
} |
スポンサード リンク