Home > Net >  Why do I see C code in file_reader.cc, shouldn't it be C?
Why do I see C code in file_reader.cc, shouldn't it be C?

Time:10-14

I'm doing an University proyect where professors give us some base code supposedly in C. But inside this C files just see C functions like cout instead of printf, vectors from STL, inheritance? This is an example of file_reader.cc:

void read (const char *nombre_archivo_pse, vector <float> &vertices, vector <int> &caras){
   unsigned num_vertices = 0, num_caras = 0;
   ifstream src;
   string na = nombre_archivo_pse;

   if (na.substr (na.find_last_of (".")   1) != "ply")
      na  = ".ply";

   abrir_archivo (na, src);
   leer_cabecera (src, num_vertices, num_caras, true);
   leer_vertices (num_vertices, vertices, src);
   leer_caras (num_vertices, num_caras, caras, src);

   cout << "archivo ply leido." << endl << flush;
}

This shouldn't be file_reader.cpp or file_reader.c ? How I code? In C or C ?

CodePudding user response:

That is C code. The file extension for C files can be .cc or .cpp.

  •  Tags:  
  • c c
  • Related