c++ help!!!
Results 1 to 8 of 8

Thread: c++ help!!!

  1. #1

    c++ help!!!

    can anybody make from this line an variabel (long or char variable or both)

    std::cout << "\n0x" << std::string << newCrc << std::endl;


    please help..

    whole code hier
    Bill has the key to the \'blue\' screen
    by tux

  2. #2
    Banned
    Join Date
    Mar 2002
    Posts
    520
    I'm not sure I get the code. Sorry.....

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Posts
    257
    You are going to have to be more specific. Are you trying to take the entire line you're printing and turn it into a string?
    -Shkuey
    Living life one line of error free code at a time.

  4. #4
    yes shkuey the entire line must be converted to a string, can you help?

    greetz
    Bill has the key to the \'blue\' screen
    by tux

  5. #5
    Senior Member
    Join Date
    Nov 2001
    Posts
    257
    You can use .c_str() to convert a variable to a character string.
    -Shkuey
    Living life one line of error free code at a time.

  6. #6
    Senior Member
    Join Date
    Oct 2001
    Posts
    638
    Is this the kind of thing you're after:

    Code:
        #include<iostream>
        #include<string>
        #include<sstream>
        using namespace std;
    
        string itos(int i)	// convert int to string
        {
            stringstream s;
            s << i;
            return s.str();
        }
    OpenBSD - The proactively secure operating system.

  7. #7
    Senior Member
    Join Date
    Nov 2001
    Posts
    472
    class FastCrc: public Crc
    {
    public:
    FastCrc (Crc::Type key)
    : Crc (key)
    {
    _table.Init (key);
    }
    void PutByte (unsigned byte);
    private:
    class Table
    {
    public:
    Table () : _key (0) {}
    void Init (Crc::Type key);
    Crc::Type operator [] (unsigned i)
    {
    return _table [i];
    }
    private:
    Crc::Type _table [256];
    Crc::Type _key;
    };
    private:
    static Table _table;
    };
    wtf is this? I've never seen a class decleration inside another class in C++. Is this standard ISO C++? I've done this myself in Java, but in my experience you should be carfeful what you put inside a class/struct in C++. Oh well, guess this option passed me by.
    ---
    proactive

  8. #8
    yes i think this isn't the ISO c++ standars but it's work

    greetz
    Bill has the key to the \'blue\' screen
    by tux

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •