.zip, .tar, .tar.gz?

This is a discussion on .zip, .tar, .tar.gz? within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by CornedBee Because << doesn't concatenate strings. + does. Thanks for the help. I'm actually going on minimal ...

  1. #16
    Registered User
    Join Date
    Oct 2006
    Posts
    118
    Quote Originally Posted by CornedBee View Post
    Because << doesn't concatenate strings. + does.
    Thanks for the help.
    I'm actually going on minimal knowledge. Mostly all I've done are the cprogramming.com tutorials. Hopefully one of these days I'll be able to get a book

    After changing this, would I have to change the << after the string too? That still gives me errors

    Thanks again!
    FlyingIsFun1217
    Last edited by FlyingIsFun1217; 06-29-2007 at 10:15 AM.

  2. #17
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Yes, of course. << only makes sense when the left-most element of the line is a stream like cout.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #18
    Registered User
    Join Date
    Oct 2006
    Posts
    118
    Quote Originally Posted by CornedBee View Post
    Yes, of course. << only makes sense when the left-most element of the line is a stream like cout.
    Ok, the <<'s are now +'s.

    Heres what I get now:

    :: === XFCE-Theme-Installer, Release ===
    /home/usr/Desktop/XFCE-Theme-Installer/XFCE-Theme-Installer/main.cpp:64: error: cannot convert ‘std::basic_string<char, std::char_traits<char>, std::allocator<char> >’ to ‘const char*’ for argument ‘1’ to ‘int system(const char*)’
    :: === Build finished: 1 errors, 0 warnings ===
    What?!?!
    FlyingIsFun1217

  4. #19
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    std::string, the C++ string, is not fully compatible with the char* that C uses, and system() was inherited from C.

    Do this:
    Code:
    system( (build command line here).c_str() );
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #20
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    To elaborate: you can't go
    Code:
    "string" + "string"
    but you can use
    Code:
    std::string("string") + "string"
    That gives you a string, so if you need a char* c-string, use
    Code:
    (std::string("string") + "string").c_str()
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #21
    Registered User
    Join Date
    Oct 2006
    Posts
    118
    Thank you very much, it is now compiling this successfully!
    Finally got a book on programming too, C++ Programming (nice book), so hopefully reading up on that will reduce my visits here in the future

    FlyingIsFun1217

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Zipping Folder to a .zip
    By (TNT) in forum Windows Programming
    Replies: 3
    Last Post: 01-06-2002, 09:27 PM

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