Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ get file content

#include <fstream>
#include <string>

int main(int argc, char** argv)
{

  std::ifstream ifs("myfile.txt");
  std::string content( (std::istreambuf_iterator<char>(ifs) ),
                       (std::istreambuf_iterator<char>()    ) );

  return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ measure time 
Cpp :: how to list environments with conda 
Cpp :: c++ time nanoseconds 
Cpp :: 3d dynamic array c++ 
Cpp :: c++ vector decimal to binary 
Cpp :: std logic vhdl 
Cpp :: min priority queue c++ 
Cpp :: unreal engine delay c++ 
Cpp :: is javascript for websites only 
Cpp :: c++ int to qstring 
Cpp :: c++ system delay 
Cpp :: c++ count bits 
Cpp :: C++ system text format 
Cpp :: cpp speed cin cout 
Cpp :: initialize 2d vector as 0 
Cpp :: bits/stdc++.h visual studio 
Cpp :: qimage transformed 
Cpp :: ue4 bind function to button clicked c++ 
Cpp :: C++ std::async wait is taking forever 
Cpp :: c++ double to string 
Cpp :: prints all the keys and values in a map c++ 
Cpp :: convert whole string to uppercase c++ 
Cpp :: use regex replace in c++ 
Cpp :: c++ absolute value 
Cpp :: qstring to char* 
Cpp :: Array sum in c++ stl 
Cpp :: iterate vector from end to begin 
Cpp :: how to get command arguments c++ 
Cpp :: c++ shared pointer 
Cpp :: count occurrences of character in string c++ 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =