Can I make istream_iterator<unsigned char> not skip spaces?

This is a discussion on Can I make istream_iterator<unsigned char> not skip spaces? within the C++ Programming forums, part of the General Programming Boards category; Basically that, I am trying to to some stream manipulation,and I would like to be able to use the iterator ...

  1. #1
    Iterator++
    Guest

    Can I make istream_iterator<unsigned char> not skip spaces?

    Basically that, I am trying to to some stream manipulation,and I would like to be able to use the iterator classes provided, but I need to be able to work with the spaces, tabs, and newlines as well.

    Does anyone know how this can be done?

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    One solution is istreambuf_iterator.

    Kuphryn

  3. #3
    iterator++
    Guest
    Could you elaborate? I can't seem to get istreambuf_iterator to work, it gives errors about converting the argument to the constructor from a basic_streambuf to an istreambuf_iterator and more troubles about bad arguments to algorithms.

    I've got my program almost the way I like it, it is basically a one pass stream editor (like sed) but using C++ objects and the only problem is that it strips out all the spaces when it works over a stream.

  4. #4
    Iterator++
    Guest

    Got it!!!!

    Stupid, stupid stupid...

    Forgot about instream.unsetf(ios::skipws);

    /bangs head against nearby wall

    Ow my head

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. trying to make a KenGen ( for a game tool )
    By lonewolfy in forum C# Programming
    Replies: 4
    Last Post: 03-28-2007, 08:23 AM
  2. How to make char array accept spaces
    By izah in forum C++ Programming
    Replies: 1
    Last Post: 10-10-2006, 02:11 PM
  3. Win32 Common Controls in C++, how do i make and use them?
    By C+noob in forum Windows Programming
    Replies: 6
    Last Post: 01-09-2006, 10:53 AM
  4. want to make this small program...
    By psycho88 in forum C++ Programming
    Replies: 8
    Last Post: 11-30-2005, 01:05 AM
  5. 'functions' in make?
    By mart_man00 in forum C Programming
    Replies: 1
    Last Post: 06-21-2003, 02:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21