如何修复C中“无法将char转换为* FILE”错误

时间:2019-07-27 10:19:05

标签: c

我对C很陌生,毫无疑问会犯一些错误,但我同意尝试并学习它来帮助朋友,但似乎遇到了麻烦。我正在尝试将这些输入写入FILE。我应该在C中学习更多东西吗?我怎么了

typedef struct kayit {
    char ad [11];
    char soyad[21];
    char marka[11];
    char tip[11];
    int model;
    char renk[11];
    unsigned long int fiyat;
}KAYIT;
int menuden_sec();
void kayit();
main()
{
    int secim;
    while(1)
    {
    secim=menuden_sec();
    switch(secim)
    {
        case 1:
            kayit();
            break;

    }
}}
int menuden_sec()
{
    int secim;
    printf("1-Kayit\n2-Arama\n3-Listele\n4-Silme\n5-Sakla\n6-Yukle\n");
    printf("7-Cikis\nLutfen yapmak istediginiz islemi giriniz.\n");
    scanf("%d",&secim);
    return secim;
}
void kayit()
{
    KAYIT oto;
    printf("Sahibinin adi=\n");
    scanf("%s",oto.ad);
    printf("Sahibinin soyadi=\n");
    scanf("%s",oto.soyad);
    printf("Arabanın markasi=\n");
    scanf("%s",oto.marka);
    printf("Arabanın modeli=\n");
    scanf("%d",&oto.model);
    printf("Arabanın tipi=\n");
    scanf("%s",oto.tip);
    printf("Arabanın rengi=\n");
    scanf("%s",oto.renk);
    printf("Arabanin fiyati=\n");
    scanf("%d",&oto.fiyat);

    FILE *fp1;
    char c;
    fp1=fopen("galeri.txt","a");

    // problem is after that
        while((c=getc(oto.ad))!=EOF);
    {
        putc(c,fp1);
    }
    fclose(fp1);    
}

0 个答案:

没有答案