Forum: C Sep 20th, 2005 |
| Replies: 0 Views: 1,967 When I look at some of my old code I got confused. The code is a bit long so I have to paste part of it
only.
CArray<CVertex*, CVertex* &> setOfVertex;
//CVertex is an object contains... |
Forum: C++ Jul 28th, 2005 |
| Replies: 3 Views: 51,890 Use a tool called GLFont under ortho view you can output text like
glFontBegin(&font);
glScalef(8.0, 8.0, 8.0);
glTranslatef(30, 30, 0);
glFontTextOut("Test", 5, 5, 0);
glFontEnd();... |
Forum: C++ Jul 22nd, 2005 |
| Replies: 3 Views: 2,532 Sorry i didn't post the full code only because it involve too much other classes, I will try to make a compilable short version here: 3 files, Command.h, Command.cpp, test.cpp
#ifndef... |
Forum: C++ Jul 22nd, 2005 |
| Replies: 3 Views: 2,532 I kind figure out where is the problem, cause I wrote a copy constructor in Command class
if I comment this function out, everything in peace
Command::Command(const Command& c){ ... |
Forum: C++ Jul 22nd, 2005 |
| Replies: 3 Views: 2,532 I define a class which hold some variables first:
class Command{
string cHandle;
int numPara;
vector<int> cPara;
public:
Command();
Command(string ucData);
... |
Forum: C++ Jul 21st, 2005 |
| Replies: 5 Views: 1,533 Thanks for suggestion, the problem is I have to initialize some variables in the
constructor of util so I am not sure if util::Show will work. |
Forum: C++ Jul 21st, 2005 |
| Replies: 5 Views: 1,533 sorry I kind of simplify it too much, the Show(char *s) method is actually part of a
util class
class util{
public:
...
void Show(char* s);
} |
Forum: C++ Jul 21st, 2005 |
| Replies: 5 Views: 1,533 I actually simplify the code to put here, the str indeed contains something before I
add s into it. So in the scenario u mentioned, the code will only output a "g", follow
by blank space.
btw I... |
Forum: C++ Jul 21st, 2005 |
| Replies: 5 Views: 1,533 in one file I define
void Show(char* s){
string str =" ";
str+=s;
cout<<str<<endl;
}
then in main I call it by |
Forum: C++ Jul 21st, 2005 |
| Replies: 3 Views: 2,349 Thanks, actually i thought I used #ifndef so this would not be included more than
once.
for the do( ), i just use it to simplify code, more like doSomething( ) |
Forum: C++ Jul 20th, 2005 |
| Replies: 3 Views: 2,349 Simplify my problem I put a short version of code here,
first header file:
namespace xxx{
class util{
public:
static int MAX_PATH ;
util();
static... |
Forum: C Jul 12th, 2005 |
| Replies: 2 Views: 2,370 Thanks a lot, I always misplace the const keyword. |
Forum: C Jul 12th, 2005 |
| Replies: 2 Views: 2,370 Potion of my code:
class UserCommand{
string cHandle; //definition of command
int numPara;
vector<int> cPara; //parameter of command
public:
UserCommand(string ucData);
//copy... |
Forum: C++ Jul 11th, 2005 |
| Replies: 2 Views: 21,795 Pretty neat solution, thanks.
Here is a Tokenizer class from Codeproject, which can tokenize string separated by
different chars like space, coma, predefined char group etc.
//Tokenizer.h
... |
Forum: C++ Jul 11th, 2005 |
| Replies: 2 Views: 21,795 if the token is separated by character like ':' or '|' how can you use sstream to tokenize it?
<< moderator edit: split thread from here >> |
Forum: C++ Jul 7th, 2005 |
| Replies: 14 Views: 5,388 I use gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
still i got segmentation error by running your code, never used oss before so I am wondering it might
be the incrementation is over limit. |
Forum: C++ Jul 7th, 2005 |
| Replies: 14 Views: 5,388 Dieter your code can't be compiled by me so I use:
std::stringstream my_stringstream;
my_stringstream << in;
string msg = my_stringstream.str();
string msg2=... |
Forum: C++ Jul 7th, 2005 |
| Replies: 10 Views: 2,743 sorry i am dumb, figured it out. BTW how to delete one's own post?
f2.c_ptr()->x
f1->c_ptr()->x
Thanks for the reply, I mean when you declare
ref<Foobar> *f1 = new ref<Foobar>;
you can't... |
Forum: C++ Jul 7th, 2005 |
| Replies: 10 Views: 2,743 Thanks for the great question and reply. One thing confused me here is, when you do
ref<Foobar> f2;
f2 is a reference of Foobar object? Or say it is a Foobar's reference, then how can I
access... |
Forum: C++ Jun 16th, 2005 |
| Replies: 8 Views: 2,905 Indeed it's difficult for me to understand why, but it truely works. Guess in practice i will follow the
first two ways as they are much more clear.
Many thanks for the help! |
Forum: C++ Jun 16th, 2005 |
| Replies: 8 Views: 2,905 write it this way and it works, but when I write function body of overload << out of class declaration
then I get error.
#include <iostream>
using namespace std;
template <typename T, int... |
Forum: C++ Jun 16th, 2005 |
| Replies: 8 Views: 2,905 Thanks a lot for the help! That solves my problem.
One more question (sorry i am messed by template), in case I don't have public interface and will access _data[] directly, then I will define <<... |
Forum: C++ Jun 16th, 2005 |
| Replies: 8 Views: 2,905 Hi, anyone can tell me what's wrong with my code? the only part has problem is the function overload << operator, any help is welcome.
#include <iostream>
using namespace std;
template... |