C/C++ Error E2268 : Call to Undefined Function 'fread' in Function retornaClientes()

Asked

Viewed 63 times

0

Hello,

I am doing a project for college, in C/C++ (more C language than C++), and I have a serious problem in fread function().

DataManipulation.h | 88 | Error E2285: Could not find a match for 'fread(_CLIENTE,unsigned int,int,FILE *)' in function retornaClientes()

DataManipulation.h | 88 | Error E2268: Call to undefined function 'fread' in function retornaClientes()|

Solutions already proposed to me: - Check that the function name and parameters are correct; - Check whether the corresponding library is being imported, in this case stdio. h;

I got this same error with other library functions that I created myself, but I always solved it in "gambiarra" mode, running away from the real solution, only now I have the problem in a function of a native library, and I have no way to do a "gambiarra"then I need to solve this problem with the function, and of course apply it to all functions that are also "buggers" but working at the base of the gambiarra.

The trick that I say is to copy the function (its implementation) and create an identity within the same library that is giving the problem, but there it is, fread() belongs to stdio. h, and I don’t have to "give it that way".

Code line in which fread use():

fread(recebeRegistro, sizeof(_CLIENTE), 1, base_cliente); //lê o registro

Line importing the libraries:

#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <string.h>

I use IDE Code::Blocks and the Borland 5.5 compiler

Thank you in advance.

1 answer

0


Personal problem solved.

My immense lack of attention, my problem was this: - The fread() function receives in the first parameter the LOCATION where the contents of the binary file will be stored, it happens that, I need to pass the POINTER to the memory location where it will be stored, and I, inattentive, tried to pass the CONTENTS of the variable "receivedRegister".

That is, silly implementation error of mine.

Att.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.