Forum: C++ Jul 14th, 2009 |
| Replies: 4 Views: 322 If the size is determined at runtime you need a full fleged dynamic memory version. Something like
#include <iostream>
int **allocs(int x,int y){
int **ret = new int*[x];
for(int... |
Forum: C++ Jul 14th, 2009 |
| Replies: 3 Views: 177 Just try to do the program,
when its done, it should be clear what should be pointers. |
Forum: C++ Jul 8th, 2009 |
| Replies: 14 Views: 475 Hi omir
People are normally quite friendly inhere,
but you should ask a specific question.
good luck |
Forum: Computer Science Jul 8th, 2009 |
| Replies: 12 Views: 1,126 So you essentially want a truthtable.
The dimension of this truthtable is n*2^n, where n is the number of coin throws.
I once did this program, and I have to agree with you,
it was annoyingly... |
Forum: C++ Jul 8th, 2009 |
| Replies: 3 Views: 552 Hi I got a code that in pseudo dos something like
ifstream os;
while(os.oef()){
os.getline(buffer,length);
}
If some condition is met, |
Forum: C++ Jul 8th, 2009 |
| Replies: 4 Views: 250 What would your rule be for definingen when a token/line is invalid?
I would check the the number of tokens in each class is first 2, then 8
Or do you want a more elaborate check? |
Forum: Computer Science Jul 7th, 2009 |
| Replies: 7 Views: 1,129 |
Forum: C Jul 7th, 2009 |
| Replies: 13 Views: 776 Ahh, cheers
Thanks!
This will come in handy |
Forum: C Jul 7th, 2009 |
| Replies: 13 Views: 776 I'm aware of the fact that I can tokenize the entire string,
but if I (dependent on the first token) just want the rest of the line,
without the need to tokenize it. How do I do that |
Forum: C Jul 6th, 2009 |
| Replies: 13 Views: 776 If I simply just want to tokenize the first element of a string and then output the remainder of the string, how can this be accomplished?
thanks
#include <stdio.h>
#include <string.h>
int... |
Forum: C Jul 2nd, 2009 |
| Replies: 9 Views: 443 Thanks ppl,
I need to keep track of the indices,
so the strtok approch wont work.
But thanks again. |
Forum: C Jul 1st, 2009 |
| Replies: 9 Views: 443 Hi,
given a cstring, I need to extract the digits in it, the digits are prefixed with either a '+' or '-'. Like
,.,.,.,+3ACT,.,.,.,.-12,.,.,.,.,.,.,.,actgncgt
#OUTPUT
3
12
I've made a... |
Forum: C++ Jun 18th, 2009 |
| Replies: 15 Views: 605 |
Forum: C++ Jun 18th, 2009 |
| Replies: 7 Views: 1,067 Could you try doing a
'ldd libPixyCANopen.so' |
Forum: C++ Jun 17th, 2009 |
| Replies: 7 Views: 462 I normally wont go into small errors in other peoples posting,
but it should be noted that code::blocks is an ide.
The compiler is most likely(depending on the setup) the mingw compiler. The mingw... |
Forum: C++ Jun 17th, 2009 |
| Replies: 7 Views: 1,067 It's shouldn't be necessary to use extern,
generally you have access to all the public variables and function in the symboltable, but only the externed are required to have the same signature, from... |
Forum: C++ Jun 17th, 2009 |
| Replies: 5 Views: 607 I think it depends on what you are doing with the file.
I've found that the FILE, strtok is by far the fastest way of reading in data.
I've been using flat files, (same number of columns in all... |
Forum: C++ Jun 16th, 2009 |
| Replies: 8 Views: 503 Yes,
you've added 'delete []', and have to dereference the double pointers.
Thanks for your help again ancient dragon. |
Forum: C++ Jun 16th, 2009 |
| Replies: 8 Views: 503 Thanks ancient dragon,
the trick was passing a pointer pointer then.
@arkm
The programming problem is simple.
check if a char* contains a trailing slash,
otherwise update the char*, so that... |
Forum: C++ Jun 16th, 2009 |
| Replies: 8 Views: 503 Hmm thanks for the char[] approach.
But I cant nail down my problem with the updated cstring.
The following code
#include<iostream>
#include<cstring>
void fix_name(char *name){ |
Forum: C++ Jun 15th, 2009 |
| Replies: 8 Views: 503 Hi
I'm having a very basic newbie problem,
The compiler forces me to do a strdup (because of cons correctness),
can I void the extra line in my code, and then I cant seem to update my array
after... |
Forum: C++ May 31st, 2009 |
| Replies: 13 Views: 1,011 Cheers arkM,
I will for sure look into this.
The avl is not part of the stl right?
So I have to make this one up.
As it is, the lookup map, takes aprox 3-4 gig memory,
I have 8 gig, but... |
Forum: C++ May 31st, 2009 |
| Replies: 13 Views: 1,011 I'm parsing 900 gig of textfiles
Using std::string as opposed to char* directly from getline,
takes around 40-60% longer. |
Forum: C++ May 31st, 2009 |
| Replies: 13 Views: 1,011 Thanks for your response.
Is the const_cast necessary because i definded my map as a
typedef std::map <const char*,int> aMap;
instead of
typedef std::map <char*,int> aMap; |
Forum: C++ May 31st, 2009 |
| Replies: 13 Views: 1,011 Cheers arkM,
I have no idea what happened here...
But the const_cast is not really necessary, is it? |
Forum: C++ May 30th, 2009 |
| Replies: 13 Views: 1,011 For anyone that cares,
this seems to do the trick.
But it is important that the item decleration is used directly at the assignmen operator
my_map::value_type item = *it;
data.erase(it);... |
Forum: C May 30th, 2009 |
| Replies: 10 Views: 558 Just out of curiosity, what languages should be faster?
Assembler, fortran? |
Forum: C May 30th, 2009 |
| Replies: 2 Views: 500 Hi,
Question
Why does valgrind complain?
Conditional jump or move depends on uninitialised value(s)
==25636== at 0x4C26D29: strlen (mc_replace_strmem.c:242)
==25636== by 0x40060A:... |
Forum: C May 30th, 2009 |
| Replies: 4 Views: 328 Thanks people,
very helpfull indeed.
Thanks |
Forum: C May 29th, 2009 |
| Replies: 4 Views: 328 Hi I stumpled upon some c-code,
which syntactically is different from what I've seen before.
first
void strreverse(char* begin, char* end) {
char aux;
while(end>begin)
aux=*end,... |
Forum: C May 29th, 2009 |
| Replies: 4 Views: 727 Well, this isn't at the bitlevel,
you are interpreting the ascii values '0' '1' as bit 0 and bit 1.
If you are interested in this bitlevel stuff,
you should look into the shift operations.... |
Forum: C++ May 29th, 2009 |
| Replies: 13 Views: 1,011 Yes I know,
this is what I write in my original post.
How do I free the memor, that I've allocated. |
Forum: C++ May 29th, 2009 |
| Replies: 8 Views: 325 It's in the nature of finite precision.
Theres not much you can do about it.
there a basicly two kinds of datatypes.
1. integral
2. float
integral being, int, char, byte etc
floats being,... |
Forum: C++ May 29th, 2009 |
| Replies: 13 Views: 1,011 Hi,
can anyone tell me why i can't clean up the memory,
and maybe a small solution.
I'm allocing memory with strdup for each key,
but I cant figure out how to erase the key with free.
Before... |
Forum: C++ May 21st, 2009 |
| Replies: 15 Views: 673 What have you included,
this doesn't look like std c++ |
Forum: C++ May 21st, 2009 |
| Replies: 18 Views: 565 void initialize_file(Horses temp_array[]) {
string line;
ifstream HorsesFile ("HorsesFile.txt");
if (HorsesFile.is_open()) {
while (! HorsesFile.eof() ) {
getline (HorsesFile,line);
... |
Forum: C++ May 21st, 2009 |
| Replies: 14 Views: 556 Write an example on datainput, and dataoutput,
like
int inPut=1234;
char *output= \\how do I convert 1234 to char* |
Forum: C++ May 21st, 2009 |
| Replies: 6 Views: 314 I think this is an excellent example of why humans shouldnt use automated translation programs. Like babelfish and translate.google.
I understand he wants to write a calculator that uses polish... |
Forum: C++ May 21st, 2009 |
| Replies: 15 Views: 673 |
Forum: C++ May 21st, 2009 |
| Replies: 10 Views: 539 If you want to read in a matrix you need some considerations.
First of all you need some cind of datastructure to have the data in some datatype.
A int** would be very suitable.
But you need... |