stdcpp/tsrc/Stdcpp_test/bcdrivers/tiostreams/src/tiostreamsblocks.cpp
changeset 22 ddc455616bd6
parent 0 e4d67989cc36
child 45 4b03adbd26ca
child 57 2efc27d87e1c
equal deleted inserted replaced
18:47c74d1534e1 22:ddc455616bd6
    33 #include<vector>
    33 #include<vector>
    34 #include <ios>
    34 #include <ios>
    35 #include <iostream>
    35 #include <iostream>
    36 #include <fstream>
    36 #include <fstream>
    37 #include <stl/char_traits.h>
    37 #include <stl/char_traits.h>
       
    38 #include <new>
    38  #include<e32std.h>
    39  #include<e32std.h>
    39 
    40 
    40 #include<exception>
    41 #include<exception>
    41 
    42 
    42 #include "tiostreams.h"
    43 #include "tiostreams.h"
   622 try
   623 try
   623 {
   624 {
   624 	
   625 	
   625 
   626 
   626 int length;
   627 int length;
   627 char * buffer;
   628 //char * buffer;
   628 char getl[8] ;
   629 char getl[8] ;
   629  filebuf fb;
   630  filebuf fb;
   630  fb.open ("c:\\TestFramework\\docs\\istream.txt",ios::in);
   631  fb.open ("c:\\TestFramework\\docs\\istream.txt",ios::in);
   631  cout<<"";
   632  cout<<"";
   632  #if  STDCPP_OOM
   633  #if  STDCPP_OOM
   889     
   890     
   890   //needs to rewrite
   891   //needs to rewrite
   891   //____________________
   892   //____________________
   892    
   893    
   893    int arr[4] = { 3,4,7,8 };
   894    int arr[4] = { 3,4,7,8 };
   894    int total=0;
   895 //   int total=0;
   895    deque<int> d(arr+0, arr+4);
   896    deque<int> d(arr+0, arr+4);
   896    //
   897    //
   897    // stream the whole vector and a sum to cout
   898    // stream the whole vector and a sum to cout
   898    //
   899    //
   899   
   900   
  1049   	{
  1050   	{
  1050   	cout<<"";	
  1051   	cout<<"";	
  1051   	#if  STDCPP_OOM
  1052   	#if  STDCPP_OOM
  1052 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1053 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1053   #endif 
  1054   #endif 
  1054   char* s;
  1055 //  char* s;
  1055    int n;
  1056 //   int n;
  1056    ios_base::openmode mode;
  1057 //   ios_base::openmode mode;
  1057 //  strstream ss3(s, n, mode);
  1058 //  strstream ss3(s, n, mode);
  1058   	strstream ss1,ss2;
  1059   	strstream ss1,ss2;
  1059   	 ss1 << "";
  1060   	 ss1 << "";
  1060   	 ss1.rdbuf();
  1061   	 ss1.rdbuf();
  1061   	 if(ss1.rdbuf( )->pcount( ) != 0)
  1062   	 if(ss1.rdbuf( )->pcount( ) != 0)
  1119      {
  1120      {
  1120      cout<<"";	
  1121      cout<<"";	
  1121      #if  STDCPP_OOM
  1122      #if  STDCPP_OOM
  1122 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1123 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1123   #endif 
  1124   #endif 
  1124   	char* s;
  1125 //  	char* s;
  1125   	int n;
  1126 //  	int n;
  1126   	ios_base::openmode mode;
  1127 //  	ios_base::openmode mode;
  1127 //  	ostrstream  oss3( s, n, mode);
  1128 //  	ostrstream  oss3( s, n, mode);
  1128   	ostrstream  oss1 ,oss2;
  1129   	ostrstream  oss1 ,oss2;
  1129   	string str;
  1130   	string str;
  1130   	 oss1 << "";
  1131   	 oss1 << "";
  1131   	 oss1.rdbuf();
  1132   	 oss1.rdbuf();
  1316 
  1317 
  1317   	#if  STDCPP_OOM
  1318   	#if  STDCPP_OOM
  1318 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1319 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1319   #endif 
  1320   #endif 
  1320   
  1321   
  1321   signed char* get;
  1322   signed char* get = NULL;
  1322   streamsize n=10;
  1323   streamsize n=10;
  1323   signed char* put;
  1324   signed char* put = NULL;
  1324    unsigned char* uget;
  1325    unsigned char* uget = NULL;
  1325    unsigned char* uput;
  1326    unsigned char* uput = NULL;
  1326   const char* cget;
  1327   const char* cget = NULL;
  1327   const signed char* csget;
  1328   const signed char* csget = NULL;
  1328   
  1329   
  1329   const unsigned char* cucget;
  1330   const unsigned char* cucget = NULL;
  1330   
  1331   
  1331   
  1332   
  1332   typedef void* (*__alloc_fn)(size_t);
  1333   typedef void* (*__alloc_fn)(size_t);
  1333   typedef void (*__free_fn)(void*);
  1334   typedef void (*__free_fn)(void*);
  1334  
  1335  
  1335   __alloc_fn  alloc_f;
  1336 //  __alloc_fn  alloc_f;
  1336  
  1337  
  1337   __free_fn free_f;
  1338 //  __free_fn free_f;
  1338   
  1339   
  1339   	//overloaded
  1340   	//overloaded
  1340   	strstreambuf  buf1(get, n,put);
  1341   	strstreambuf  buf1(get, n,put);
  1341   	
  1342   	
  1342   	//overloaded
  1343   	//overloaded
  1489  int failures=0;
  1490  int failures=0;
  1490  try
  1491  try
  1491  {
  1492  {
  1492  	
  1493  	
  1493  
  1494  
  1494  streamoff s;
  1495 // streamoff s;
  1495    ifstream file( "c:\\TestFramework\\docs\\fpos_state.txt" );
  1496    ifstream file( "c:\\TestFramework\\docs\\fpos_state.txt" );
  1496   cout<<"";
  1497   cout<<"";
  1497     #if  STDCPP_OOM
  1498     #if  STDCPP_OOM
  1498 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1499 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1499   #endif
  1500   #endif