Check out example codes for "print contents of cpp file". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>
#include <fstream>

int main()
{
    std::ifstream f("file.txt");

    if (f.is_open())
        std::cout << f.rdbuf();
}

Learn ReactJs, React Native from akashmittal.com