Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / tests / Bug_3532_Regression_Test.cpp
blob08ed268ec5779a3a86529b88e66fab003ad325f5
1 /**
2 * @file Bug_3532_Regression_Test.cpp
4 * Reproduces the problems reported in bug 3532
5 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3532
7 * @author Martin Gaus <Gaus at gmx dot de>
8 */
10 #include "test_config.h"
11 #include "ace/ACE.h"
13 int
14 run_main (int, ACE_TCHAR *[])
16 ACE_START_TEST (ACE_TEXT ("Bug_3532_Regression_Test"));
18 char Buffer[10];
19 int result = 0;
21 // Write a ASCII file with one byte (no BOM)
22 Buffer[0] = 'T';
23 FILE* pFile = ACE_OS::fopen(ACE_TEXT("OneByteFile"), ACE_TEXT("wb"));
24 ACE_OS::fwrite(&Buffer, 1, 1, pFile);
25 ACE_OS::fclose(pFile);
27 // Reopen the file and read the byte
28 Buffer[0] = '-';
29 pFile = ACE_OS::fopen(ACE_TEXT("OneByteFile"), ACE_TEXT("rb"));
30 size_t BytesRead = ACE_OS::fread(&Buffer, 1, 1, pFile);
31 if(BytesRead == 1)
33 if(Buffer[0] != 'T')
35 ++result;
36 ACE_ERROR ((LM_ERROR,
37 ACE_TEXT ("Error: 'T' expected!!!\n")));
40 else
42 ++result;
43 ACE_ERROR ((LM_ERROR,
44 ACE_TEXT ("Error: One byte should be read!!!\n")));
47 ACE_OS::fclose(pFile);
49 ACE_END_TEST;
51 return result;