what would i use to replace std::cin.ignore (); from a C++ program to make that section of code work in a C program
Need help converting some c++ to c
Collapse
X
-
Read this link and build a function in C that implements the functionality described in the page. Do the same for any other c++ std methods. Remember that c is much simpler than c++ so all you need to do in general is to convert class-like structures into c structures and corresponding functions. Basically, sit down and start reading the c++ standard documentation. If you can't find the equivalent function in the C standard, you will have to understand what the method in a class or the c++ function does and emulate that with your own functions.
Code example:
C++
CCode:class foo { public: int x, y, z; int Add(int x, int y, int z); };
Code:typedef struct { int x; int y; int z; }foo; int foo_add(foo* f) { ... }
Comment