Search
 
SCRIPT & CODE EXAMPLE
 

CPP

read file into vector

std::vector<char> vec;
if (FILE *fp = fopen("filename", "r"))
{
	char buf[1024];
	while (size_t len = fread(buf, 1, sizeof(buf), fp))
    {
		v.insert(vec.end(), buf, buf + len);
    }
	fclose(fp);
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: pow in c++ 
Cpp :: c++ declaring and initializing strings 
Cpp :: cpp bubble sort 
Cpp :: c++ swapping two numbers 
Cpp :: convert int to binary string c++ 
Cpp :: round double to n decimal places c++ 
Cpp :: c++ open file 
Cpp :: adding elements to a vector c++ 
Cpp :: how to add colored text in c++ 
Cpp :: c++ for in 
Cpp :: how to round to nearest whole number unity 
Cpp :: map in c++ sorted descending order 
Cpp :: how to make calculaor in c++ 
Cpp :: matplotlib hide numbers on axis 
Cpp :: number of lines in c++ files 
Cpp :: Write C++ program to sort an array in ascending order 
Cpp :: delete a node from binery search tree c++ 
Cpp :: find primes in a range in c++ 
Cpp :: get window position 
Cpp :: convert integer to string c++ 
Cpp :: c++ reference 
Cpp :: read and write file in c++ 
Cpp :: how to split a string in c++ 
Cpp :: how to dynamically allocate an array c++ 
Cpp :: c++ output 
Cpp :: find duplicate from an array c++ 
Cpp :: cpp create lambda with recursion 
Cpp :: pointer in return function c++ 
Cpp :: cpp return array 
Cpp :: c++ cout without include iostream 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =