Thanks for the replies, I did end up getting it to work.
However now its gone to crazy on me.
Code:
#include <iostream>
#include <string>
#include <fstream>
#include <cctype>
using namespace std;
string readLineFromFile (string&);
string cleanString (const string& line);
int main( void )
{
string line, nospc, cleaned;
int j = 0;
int y = 0;
nospc="";
cleaned="";
line = "akj832 adf83";
int len = line.length();
for (int i=0; i<len; i++)
{
if (isalnum(line[i]))
{
nospc = nospc + line [i];
}
}
int len2 = nospc.length();
for (int h=0; h<len2; h++)
{
cleaned[h] = tolower(cleaned[h]);
}
cout << cleaned ;
return 0;
}
Thats the code I have so far (ignore the functions, they will be added later) and for me it comes up with an "unhandled exception" and the program crashes when I try to run it. I can't figure out what is wrong with it. Any suggestions?
Note: If I put something into the cleaned string at the begining it works.