int to string
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 4 of 4

Thread: int to string

Threaded View

  1. #1
    Join Date
    Mar 2009

    int to string

    Just wondered if I have missed something and if the following code could be more elegant?
    I'm hunting through a network trace. Each row is in s_current_row. If I find one of the searchstrings (could be multiple occurrences of each searchstring) stored in array searchstring[x] then I replace it with some values including the integer that is the index of the searchstring.

    Any thoughts for still a newbie very welcome, Nigel

    	// loop through search strings
    	          	int result;
    	          	for (int x = 1; x <= countdef; x++)
    	          		while ((result = s_current_row.find(searchstring[x], 0)) != -1)
    		          		string temp = "***";
          				stringstream out;
    				out << x;
    				temp += out.str();
    				temp += "|";
    		          		temp += database[x];
    		          		temp += "|";
    		          		temp += field[x];
    		          		temp += "***";
    		          		s_current_row.replace( result, searchstring[x].size(), temp );
    Last edited by nigelhoath; April 18th, 2009 at 11:17 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center