server.cpp
/******************************************************************
/ Basic parser that extracts the numbers of a data message string
/ and parses them from a string to an integer.
/ Outputs parsed data to terminal and a text file.
/ @param fileName: output text file name
/ @param rawData: string data to be parsed into integer
/*****************************************************************/
Basic parser that extracts the numbers of a data message string
and parses them from a string to an integer.
Outputs parsed data to terminal and a text file.
Basic parser that extracts the numbers of a data message string and parses them from a string to an integer . Outputs parsed data to terminal and a text file .
void parseToFile(char fileName[], string rawData)
{
    	int parsedData;
	ofstream ofFile;
    	istringstream issData(rawData);
   	string singleObject;
	cout << "Parsed Data (string -> int):\n";
    	while(getline(issData, singleObject, ' '))
    	{
        	try
        	{
            		parsedData = stoi(singleObject, nullptr, 10);
            		cout << parsedData << endl;
			writeFile(fileName, parsedData);
        	}
        	catch(...)
        	{
            		cout << "Invalid input: " << singleObject << endl;
        	}
    	}
}
void parseToFile ( char fileName [ ] , string rawData ) { int parsedData ; ofstream ofFile ; istringstream issData ( rawData ) ; string singleObject ; cout << " \n " ; while ( getline ( issData , singleObject , ' ' ) ) { try { parsedData = stoi ( singleObject , nullptr , 10 ) ; cout << parsedData << endl ; writeFile ( fileName , parsedData ) ; } catch ( ... ) { cout << " " << singleObject << endl ; } } }
Basic parser that extracts the numbers of a data message string
and parses them from a string to an integer.
Basic parser that extracts the numbers of a data message string and parses them from a string to an integer .
//uses istringstream and getline to input into singleObject //delimited by a space