Skip to content

Instantly share code, notes, and snippets.

@chessai
Created October 11, 2018 02:34
Show Gist options
  • Save chessai/56f24aebeeaf0ffc493f052783685346 to your computer and use it in GitHub Desktop.
Save chessai/56f24aebeeaf0ffc493f052783685346 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <string>
#include <stdio.h>
#include <cstring>
int main ()
{
std::ifstream in("infile.txt");
std::string contents((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());
char * nutt = new char [contents.length() + 1];
std:: strcpy (nutt, contents.c_str());
for(int i = 0; i < contents.length(); i++)
{
std::cout << nutt[i];
}
// std::cout << nutt.length();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment