c++ - no matching function for call to 'fscanf' -


i'm trying read time file example (12:00 a) need read in 3 parts. here have.

#include <iostream> #include <fstream> #include <stdio.h> using namespace std;  int main() {     string name, filename;     ifstream inputfile;      cout << "what name of file provessed ";     cin >> filename;     inputfile.open(filename.c_str());      getline(inputfile, name);     fscanf (inputfile, "%d:%d %c", &starth, &startm, &startap);     fscanf (inputfile, "%d:%d %c", &endh, &endm, &endap);     inputfile >> payrate; 

i'm getting error title , i'm not sure i'm doing wrong.

function fscanf standard c function declared in header <cstdio> following way (i show how function declared in header <stdio.h> in c. in fact same declaration except keyword restrict used in c++)

int fscanf(file * restrict stream, const char * restrict format, ...); 

as can see there no parameter of type std::ifstream

so compiler issues error because unable find function name fscanf has first parameter of type std::ifstream , @ same time can not implicitly convert object of type std::ifstream pointer of type file *

you should not mix c++ stream functions c stream functions.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -