Thread: sstream header [VERY URGENT]

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    124

    sstream header [VERY URGENT]

    hi have to submit in an hour...my program compiles on Borland...in unix environment for the line
    #include <sstream.h>

    or if i change it to : #include <sstream> it doesn't compile...says no such file or directory...
    plz help quick...

    if ure wondering i also have that line using namespace std...

    Farooq

  2. #2
    not understanding your problem
    you should post at least partical code
    and the error your getting!

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    124
    Code:
    #pragma hdrstop
    #pragma argsused
    #include <stdlib.h>
    #include <iostream.h>
    #include <fstream.h>
    #include <math.h>
    #include <sstream>
    
    using namespace std;
    when i compile in unix i get an error that says:

    sstream : No such file or directory

    im using sstream to perform string parsing in my code...works perfectly in Borland C++...won't compile on UNIX and i have to submit the code in UNIX...

    Regards,

    Farooq

  4. #4
    Registered User
    Join Date
    Sep 2004
    Posts
    124
    nevermind...i submitted the assignment...

    hk_mp5kpdw, since you suggested the sstream thing...could you please post a possible way around the above problem...you method works perfectly in Borland C++ but in UNIX i couldn't get rid of the above error...i tried copying the file from Borland's directory into the unix project folder...doesn't work!

    i hate UNIX...second assignment down the drain cause of it...why is it so preferred anyway...pathetic interface to program on...since i was getting the above error i commented out the part where i was using the stream buffer etc...and used my previous code...now it gives me a straight in your face segmentation fault...the same thing it would give me in my previous project although ive put massive tests in the code just to prevent some wrong accesses etc...worthless junk! I swear...

    Regards,

    Farooq

  5. #5
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    There is a version of stringstreams that I think works with character streams instead of std::strings. As an example, I think it would go like:

    Code:
    #include <strstream>
    #include <iostream>
    
    int main()
    {
        char word[] = "Hello World";
        char temp[20];
        std::istrstream parser(word);
        while( parser >> temp )
            std::cout << temp << std::endl;
    }
    Should output:
    Code:
    Hello
    World
    If that doesn't work, you might try the older version of that strstream header:

    Code:
    #include <strstrea.h>
    #include <iostream>
    
    int main()
    {
        char word[] = "Hello World";
        char temp[20];
        istrstream parser(word);
        while( parser >> temp )
            std::cout << temp << std::endl;
    }
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  6. #6
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by alvifarooq
    i hate UNIX...second assignment down the drain cause of it...why is it so preferred anyway...pathetic interface to program on...
    I always doubt the skill of people that complain about their environment too much... I've been programming on windows for at least 2-3 years, and I made a jump to linux ~1 year ago... now, with the exception of non-standard stuff, I can write code that will compile fine on both windows and linux...

    this is why you need to learn the standards... it'll help you out in this kind of situation... the biggest trouble you'll have with coding windows/linux is OS/compiler specific. the compiler-specific stuff can be weeded out by using GCC, or a MingW port thereof (dev-c++ for windows). the OS stuff you'll just have to deal with or move to JAVA...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  7. #7
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Actually I have found that using a combo of vim and make on linux to be far superior to any windows enviroment.

    Reasons:
    • Extreme control over file dependicies. Having to set them yourself re-enforces the structure in your mind
    • VIM is the single best editor I've ever used.
    • Debugger that actually works. I have yet to find a window's based debugger that worked well. gdb has worked every single time I gone to use it.
    • gcc/g++ can easily be told to disallow anything that is not standard.
    • I can alt-tab to another ssh session faster then I can move a mouse. For me the lack of mouse interface is great.
    • Linux doesn't allow fflush(stdin);

  8. #8
    Registered User
    Join Date
    Sep 2004
    Posts
    124
    ya i guess skill's a big factor...i haven't really programmed a lot on Unix...i was just annoyed because of the assignment deal yesterday...and the fact that i have to connect to unix on my university LAN and the only interface is a black screen with lines in white...it's hard to stare at something like that for a whole month...

    anyway thanks for the replies...ill keep all this in mind for programs i make later!

    Regards,

    Farooq

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Obtaining source & destination IP,details of ICMP Header & each of field of it ???
    By cromologic in forum Networking/Device Communication
    Replies: 1
    Last Post: 04-29-2006, 02:49 PM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM