Mail Archives: djgpp/2001/09/19/02:05:06
On Tue, 18 Sep 2001, Chris wrote:
> Where can we find the latest version of DJGPP
> with the C++ std. I cant seem to get this to compile
> with 2.95
>
> #include <iostream>
> #include <algorithm>
> #include <vector>
> #include <fstream>
> #include <cstdlib>
> #include <limits>
>
> int main()
> {
> std::ifstream in("dic.txt");
> std::vector<std::size_t> cs(std::numeric_limits<unsigned char>::max());
> std::istreambuf_iterator<char> it(in);
> std::istreambuf_iterator<char> end;
> while(it != end)
> {
> unsigned char ch=(unsigned char)*it++;
> ++cs[ch];
> }
> in.close();
> unsigned char pos='\0';
> std::size_t icount = 0;
> while(pos != cs.size())
> {
> if (cs[pos] > 0)
> {
> std::cout<<(char)pos<<": "<<cs[pos]<<", ";
> if(++icount%5==0)
> std::cout<<'\n';
> }
> ++pos;
> }
> std::cout<<"Goodbye"<<std::endl;
>
Code uses features not supported in libstdc++ from gcc-2.95.X.
Use either STLPort (untested) or try upgrading to gcc-3.0.1:
http://www.ltn.lv/~pavenis/gcctest.html
(not uploaded to simtelnet yet)
Andris
- Raw text -