Search:
Type: Posts; User: Assmaster
Search:
Search took 0.06 seconds.
-
Couldn't you just try, and print'em out?
Anyhoo:
// argc = the count of space separated "words" in the commandline:
argc = 7
// Each "word" has its own index in the argv array:
argv[0] =...
-
Firstly... Like Andreas said... new should not return NULL according to the standard. If allocation fails, it should throw a std::bad_alloc exception, and therefore you should not need to check for...
-
April 30th, 2004, 10:52 AM
Some code would be nice... At the very least your fprintf line and the variables it uses.
-
April 29th, 2004, 06:42 PM
So you basically want to stop using std::string and std::vector, and instead use c-style strings and arrays?
Well it will work. But why on earth would you want to do that? Stay with std::vector...
-
April 29th, 2004, 06:32 PM
In fact... This won't work at all, and that's probably the error you're recieving.
When the compiler sees a templated function like yours, and you instantiate it for one type, it will compile the...
-
April 29th, 2004, 06:17 PM
What's this m_bool variable? You've used it twice, but havent defined it anywhere.
And why does setdata need to be templated? If it's only to save you the trouble of writing one setdata for each...
-
April 29th, 2004, 04:18 PM
p++ would be the same address as &p[1]
p[0] != p but *p
p[1] != p+sizeof(data_type) but rather *(p+1).
Also... p+sizeof(data_type) would only be the same address as p++ if data_type is char....
-
April 29th, 2004, 04:08 PM
Umm.. I don't think I understand what you're asking, but there's nothing wrong with the single line of code you posted. (Except from a missing ';' that is!) And certainly nothing that should end up...
-
April 28th, 2004, 07:40 PM
Erase only takes one iterator parameter. It's simply .erase(i).
But... What's with the usage of the this pointer here? You aren't by any chance deriving from std::list or something? In that case.....
-
April 28th, 2004, 07:32 PM
If you have already implemented the operator == char* for your class (Looks like you have), and the Text member-variable contains the actual c-string:
bool CStr::operator ==(const CStr& rhs)
{...
-
April 26th, 2004, 05:38 PM
The obious thing to do, would be to simply move the definition of a into the for-loop's curlies. That way it will be constructed/destructed each iteration. (Giving you an empty stream each time)
...
-
April 26th, 2004, 05:21 PM
Is there any perticular reason you are using a char[10] and not a std::string?
std::string Result;
std::string Str("Hello Gurus, good day!");
int n = 10;
Result = Str.substr(Str.size() - n , n);
-
April 26th, 2004, 03:02 PM
Why not use a std::vector?
std::vector<int> temp(int n){
int i;
std::vector<int> array(n);
for (i=0;i<n;i++)
array[i] = i;
return array;
}
This way the returned array will be...
-
April 24th, 2004, 08:51 PM
Use a std::ostringstream to build the string before passing it to the messagebox:
#include <sstream>
...
std::ostringstream message;
message << "This is a text with a number: " << 100 << ", and...
-
April 23rd, 2004, 06:36 PM
Just square the value of the 8bit variable. The 8bit value 256, will then end up being 65536 (the max for a 16bit variable), but 0 will still be 0. Is that what you wanted?
unsigned char some_value...
-
April 21st, 2004, 05:59 AM
Since you are passing the struct as a cMyStruct* to the function, how can you not know? The function will recieve a cMyStruct and since member-variable-names are known at compile time, just check the...
-
April 19th, 2004, 04:33 PM
No it doesn't. You can't declare variables in the header without using extern. That will lead to one variable being defined for each of the cpp files that include the header. This is the reason for...
-
April 19th, 2004, 09:48 AM
I really don't understand why you need to do any casting here. Assuming you only only have one CNode::SetVehicle function (no overloading), it will have to take a cvehiculo* as a parameter to be able...
-
April 18th, 2004, 06:35 PM
doNonVirtual() returns a void, and you're trying to pass that to the << operator of cout. That shouldn't and doesn't work.
-
April 18th, 2004, 05:42 PM
Well what type does the VehicleList.Add() function take as a parameter? I assume it's a cVehicle*, and in that case, it doesn't matter if the create function returns a cVehicle*, cCar* or a cVan*.
-
April 6th, 2004, 12:22 PM
You shouldn't put "using namespace whatever;" in any header file. Doing that will result in that namespace being used by all files that include your header. Something that in turn can result in name...
-
April 6th, 2004, 11:49 AM
It's not a book, but a good reference none the less: http://www.sgi.com/tech/stl/table_of_contents.html
-
April 6th, 2004, 11:43 AM
Use std::bitset:
#include <iostream>
#include <fstream>
#include <bitset>
int main()
{
std::ifstream InFile("binary.txt");
std::bitset<8> Byte;
-
April 6th, 2004, 11:12 AM
Use an unsigned char. The value 129 overflows the signed char variable.
-
April 4th, 2004, 02:31 PM
You're trying to set the reference to the pointer to NULL. C++ doesn't allow references to be NULL.
|
Click Here to Expand Forum to Full Width
|