Search This Blog

Monday, 10 January 2011

C++

Converts an integer into a string:
(This works also with other data types float ...) 

#include <sstream>
int i = someNumber;
std::string s;
std::stringstream out;

out << i;
s = out.str();
Output to files:
#include <iostream>
#include <fstream>

std::ofstream myfile;
myfile.open("example.txt);
myfile << "Writing to my file ...\n";
myfile.close;

No comments:

Post a Comment