開発環境:Visualstudio2012 Windows8 64bit
使用言語:C++
CSVファイルの中は
ことわざ(漢字含む),Kotowaza of English
となっています。
初心者です。関数を2,3個同時に使うとなると、悩み始めるレベルです。
とりあえず、いろいろな関数を調べてかいては見たんですが、案の定エラーが起きました。
訂正も何度かしましたがわからない...というのが現状です。
#include <stdio.h>
#include <string.h>
typedef struct tagKOTOWAZA{
char japanese[50];
char english[50];
} KOTOWAZA;
int main(void)
{
FILE *fin;
char buf[256];
KOTOWAZA c[200];
int i, count;
char name[50];
fin = fopen("Book1.csv", "r");
count = 0;
while(fgets(buf, 256, fin) != NULL)
{
sscanf(buf, "%s %s",
c[count].japanese,
c[count].english);
count++;
}
fclose(fin);
printf("ことわざを入力してください");
scanf("%49s", name);
for(i = 0; i < count; i++)
{
if (strcmp(c[i].japanese, name) == 0)
{
printf("%s(%s/%d)", c[i].japanese, c[i].english);
break;
}
}
if (i == count) printf("見つかりません。\n");
return 0;
}
(17): error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
(218) : 'fopen' の宣言を確認してください。