User Tools

Site Tools


c_-_c_string_streams:istrstream

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
c_-_c_string_streams:istrstream [2017/10/12 13:09] peterc_-_c_string_streams:istrstream [2017/10/12 13:14] (current) – removed peter
Line 1: Line 1:
-====== C - C++ Streams - istrstream ====== 
- 
-<code cpp> 
-#include <iostream> 
-#include <strstream> 
-using namespace std; 
-  
-int main() 
-{ 
-  char s[] = "10 Hello 0x75 42.73 OK"; 
-  
-  istrstream ins(s); 
-  
-  int i; 
-  char str[80]; 
-  float f; 
-  
-  // reading: 10 Hello 
-  ins >> i; 
-  ins >> str; 
-  cout << i << " " << str << endl; 
-  
-  // reading 0x75 42.73 OK 
-  ins >> hex >> i; 
-  ins >> f; 
-  ins >> str; 
-  
-  cout << hex << i << " " << f << " " << str; 
-  
-  return 0; 
-} 
-</code> 
  
c_-_c_string_streams/istrstream.1507813776.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki