Object files are compiled code modules useful to split large code files into small modules to enable to manage them easily. In this article, we are going to discuss the steps to create object files and use them from other code modules. When we compile a program, the ‘C’ compiler will generate object files (“.o” […]
C Programming – Using bitwise operators
‘C’ provides bitwise operators to deal with bits. Each bit is either “0” or “1”. In this article we are going to discuss how to use bitwise operators in ‘C’. ‘C’ provides the following bitwise operators. & (Ampersand – Bitwise AND Operator) | (Pipe Symbol – Bitwise OR Operator) ^ (Cap Symbol – Bitwise XOR […]
C Programming – Dealing with files – How to use open function to open a file?
We have discussed that ‘C’ provides buffered and un-buffered functions for file management. We have already discussed some of the buffered functions in our previous articles; “C Programming – Dealing with files – How to read from a file?“, “C Programming – Dealing with files – How to write to the file?” and “C Programming – Dealing […]
C Programming – Dealing with files – How to fetch a record from the file?
In our previous article, we have used “getrecord” function. We will start this article with this function. We have to implement “getrecord” to fetch a record from the “employee.dat” file. It will check the “employee.dat” file for an employee record based on the given employee number. If it finds the employee record it will return […]
C Programming – Dealing with files – How to write to the file?
We have discussed opening & reading from the file in our previous Article “C Programming – Dealing with files – How to read from a file?“. fwrite function Another important buffered function, ‘C’ provides is fwrite function. fwrite function writes to the file. The file should be opened with fopen function call. The syntax of […]
C Programming – Dealing with files – How to read from a file?
C library provides good number of file handling functions to deal with files and directories / folders. Generally we can classify these functions as: Buffered functions and Un-buffered functions. Un-buffered functions are the raw functions deals directly with storage devices. Whereas, buffered functions maintains memory buffers to improve the performance and reduce the number of […]
C++ – Operator Overloading
One of the beautiful feature of ‘C++’ is it’s ability to support Operator Overloading. ‘C++’ Operator Overloading allows to change the behavior of operators when using them with ‘C++’ class objects. One of the best example of Operator Overloading is ‘+’ operator. Usually ‘+’ operator will add two integer operands and produce an integer result. […]
C++: Templates
C++ Templates are used for writing generic programming. C++ allows to define function templates and class templates. In C++, we use template keyword to write generic programming. The syntax of the template declaration starts with template<class T> Where template is the keyword which indicates the particular function or class is a generic function or class. Here […]
COM – Creating a COM Component using C++ – IClassFactory implementation
CoCreateInstance depends on IClassFactory to create class instances. We have looked into IClassFactory‘s methods and we have implemented these methods in our previous article. Let’s include IClassFactory‘s implementation into our HelloComponent. We already have HelloComponent‘s declaration in the “HelloComponent.h” file and its implementation in the “HelloComponent.cpp” file. In the same way, we will add the IClassFactory […]
C++ – Calling Virtual functions from class Destructors
C++ allows virtual functions to resolve function calls at run-time. This is called late-binding. Like virtual functions, C++ allows virtual destructors to delete the objects properly in inheritance hierarchy. C++ allows to call virtual functions from class destructors. But what will happen when it calls these virtual function from class destructors? Let’s take an example, […]