[uClibc] uclibc-toolchain and C++ with streams

Daniel Dittmann ddittmann at gmx.de
Fri Aug 1 07:25:21 UTC 2003


Hi all,

actually i use the gcc-2.95.4 created with the uclibc-toolchain 
(uclibc-0.9.20, kernel-headers-2.4.21).
The attached code i compiled successfully.

When i start the binary, the output looks like:

 >./streamtest
aa
 >

The same code compiled with "normal" gcc or the gcc from 
uclibc-buildroot looks:

 >./streamtest
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789
 >

Is there an error in STLport streams or uClibc? I checked both
mailinglists without any success. I found many postings, that the
standard libstdc++ (from gcc-package) don't work with uclibc & gcc-2.95,
but nothing about streams.


Cheers
Daniel



streamtest.cpp:
#include <iostream>
#include <fstream>
#include <string>

int main(void)
{

   std::ifstream testStream ( "./testabc.txt" );

   if ( ! testStream )
   {
     std::cerr << "can't open" << std::endl;
     return 1;
   }

   char ch;

   while (!testStream.eof()) {
     testStream.get(ch);
     std::cout.put(ch);
   }

   if (!testStream.eof())
     std::cerr << "can't read" << std::endl;

   std::cout << std::endl;

   return 0;
}


testabc.txt:
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789





More information about the uClibc mailing list