cturbo-c++

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


I am using turbo c++. I am getting the error "Declaration Syntax error" in 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 image1


Solution

  • FILE* and fopen() normally require you to #include <stdio.h>. I assume that is true for Turbo C++ too.