Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7560387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:53:24+00:00 2026-05-30T12:53:24+00:00

I wrote a simple function in Visual Studio to be able to study how

  • 0

I wrote a simple function in Visual Studio to be able to study how to write a C project in Visual Studio but it gave the following errors:

Error   1   error C2275: 'FILE' : illegal use of this type as an expression        
c:\users\henry\documents\visual studio 2010\projects\exc4\exc4\measurement.c    25    
1   Exc4

Error   2   error C2065: 'file' : undeclared identifier   
c:\users\henry\documents\visual studio 2010\projects\exc4\exc4\measurement.c    25  
1   Exc4

  Error 3   error C2065: 'file' : undeclared identifier 
 c:\users\henry\documents\visual studio 2010\projects\exc4\exc4\measurement.c   31     1    
    Exc4
  Error 6   error C2065: 'file' : undeclared identifier 
   c:\users\henry\documents\visual studio 2010\projects\exc4\exc4\measurement.c 39  1   
   Exc4
    Error   9   error C2065: 'file' : undeclared identifier 
   c:\users\henry\documents\visual studio 2010\projects\exc4\exc4\measurement.c 41  1   
    Exc4

   Error    12  error C2065: 'file' : undeclared identifier 
    c:\users\henry\documents\visual studio 2010\projects\exc4\exc4\measurement.c    45  1   
   Exc4
17  IntelliSense: a value of type "void *" cannot be used to initialize an 
     entity of type "Tmeasurement *"    c:\users\henry\documents\visual studio 
      2010\projects\exc4\exc4\measurement.c 99  33  Exc4

I never had this error when i compiled the function on the mac Xcode compiler. Hoping any one out there could explain why the statement FILE *file is not identified.

Tmeasurement readMeasurements(Tmeasurement a, char *filename)
{
    int filesize, i;
    struct stat st;
    stat(filename, &st);
    filesize = st.st_size;

    a.ArraySize = filesize;
    a.measureArray = (float*)malloc(filesize*sizeof(float));

    FILE *file = fopen(filename, "r+");
    // FILE *file = fopen(filename, "r");
    /*filesize = fread(a.measureArray, 1, filesize, file);
    a.ArraySize = filesize;*/

    if(file==NULL)
    {
        printf("Could not open mea.dat!\n");
        return; 
    }

    for(i=0;  i<102 &&(fgetc(file))!=EOF;i++)
    {
        fscanf(file,"%e",&a.measureArray[i]);
    }

    fclose(file);
    return a;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:53:26+00:00Added an answer on May 30, 2026 at 12:53 pm

    Microsoft compilers only support C89 standard, so variable declarations must be at the beginning of scope before any other statements.

    Change to:

    Tmeasurement readMeasurements(Tmeasurement a, char *filename)
    {
       int filesize, i;
       struct stat st;
       FILE* file;
    
       ...
    
       file = fopen(filename, "r+");
    
       ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just wrote a simple C++ program in Visual Studio 2010 and I use
I wrote the following simple function that takes two parameters mostly coming from another
I wrote this simple C code and compiled it using Visual Studio 2010, with
i wrote a simple function in controller public string LinkProjectSquareFilter(int squareId) { return squareId.ToString();
I wrote a simple javascript function to display a progressbar with the help of
I wish to write a simple javascript function that toggles the visibility of a
I'm trying to write a simple Vim function that takes the name of a
I wrote a simple Windows Forms program in C#. I want to be able
I wrote a simple jQuery function to submit data from a textarea. The script
I was playing around with F# (Visual Studio 2010 beta 1), and I wrote

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.