-
May 13th, 2002, 06:39 PM
#1
Member
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
-
May 13th, 2002, 06:42 PM
#2
I'm not sure I get the code. Sorry.....
-
May 13th, 2002, 06:51 PM
#3
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.
-
May 13th, 2002, 07:29 PM
#4
Member
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
-
May 14th, 2002, 09:10 AM
#5
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.
-
May 14th, 2002, 10:33 AM
#6
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.
-
May 14th, 2002, 10:52 AM
#7
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.
-
May 14th, 2002, 12:23 PM
#8
Member
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
-
Forum Rules
|
|