I have pasted my cpp code below, my goal is removing the whitespace from my .txt file. Is someone able to provide suggestions and help me figure this out?
#include <iostream>
#include <sstream>
using namespace std;
string solve(string s) {
string answer = "", temp;
stringstream ss;
ss << s;
while(!ss.eof()) {
ss >> temp;
answer+=temp;
}
}
return answer;
}
int main() {
char buffer[100];
FILE *fp = fopen("input.txt", "r");
while (fgets(buffer, sizeof(buffer), fp))
{
cout << solve(fp);
}
fclose(fp);
return (0);
}