简体   繁体   English

FILE *fp (TURBO C++) 中的声明语法错误

[英]Declaration syntax error in FILE *fp (TURBO C++)

I am using turbo c++.我正在使用涡轮增压 c++。 I am getting the error "Declaration Syntax error" in FILE *fp;我在 FILE *fp; 中收到错误“声明语法错误”; the following is my code.以下是我的代码。

#include <bios.h>
#include <dos.h>
FILE *fp;
unsigned char buf[512];
unsigned char st[60];
unsigned char headno[10];
unsigned char secno[10];
unsigned char trackno[10];
void main (void)
{
    int i ;
    for (i=0;i<512;i++)
        buf[i]=0;
    gets(st);
    fp=fopen(st,"wb");
    printf("Head ");
    gets(headno);
    puts (headno);
    printf("\nsector ");
    gets(secno);
    puts(secno);
    printf("\ntrack ");
    gets(trackno);
    puts(trackno);
    i = biosdisk(2,0x80,atoi(headno),
    atoi(trackno),atoi(secno),1,buf) ;
    if (*(((char *)(&i))+1)==0)
    {
        fwrite(buf,1,512,fp);
        fclose(fp);
    }
    else
        printf("Cannot Read Error# = %x",i);
}

The error is shown in the image 1错误如图1所示

FILE* and fopen() normally require you to #include <stdio.h> . FILE*fopen()通常要求您#include <stdio.h> I assume that is true for Turbo C++ too.我认为 Turbo C++ 也是如此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM