# include
# include
# include
# include
# include
using namespace STD;
class logcall: Public ace_log_msg_callback
{< br> Public:
logcall () {}< br> ~ Logcall () {}< br> virtual void log (ace_log_record & log_record)
{< br> cout <"this is printed after callback:" cout }< BR >};
Int ace_tmain (INT, ace_tchar * [])
{
Logcall * pcall = new logcall ();
Ace_log_msg-> set_flags (ace_log_msg: msg_callback );
// Ace_log_msg-> clr_flags (ace_log_msg: stderr );
Ace_log_msg-> msg_callback (pcall );
Ace_debug (lm_error, ace_text ("% d hello everyone \ n ")));
Getchar ();
Return 0;
}
File * stream;
Char list [30];
Int I, numread, numwritten;
/* Open File in text mode :*/
If (Stream = fopen ("fread. Out", "W + T "))! = NULL)
{
For (I = 0; I <25; I ++)
List [I] = (char) ('Z'-I );
/* Write 25 characters to stream */
Numwritten = fwrite (list, sizeof (char), 25, stream );
Printf ("wrote % d items \ n", numwritten );
Fclose (Stream );
}
Else
Printf ("problem opening the file \ n ");
If (Stream = fopen ("fread. Out", "R + T "))! = NULL)
{< br>/* attempt to read in 25 characters */
numread = fread (list, sizeof (char), 25, stream );
printf ("number of items read = % d \ n", numread);
printf ("Contents of buffer = %. 25s \ n ", list);
fclose (Stream);
}< br> else
printf (" file cocould not be opened \ n ");