Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>double *ptr;
>>spe_in_mbox_ write(thread_args.spe_context,(uint32_t*)&ptr,SPE_MBOX...)

What you are sending is a pointer to an uninitialized pointer. If the function attempts to write to it that may result in bus error because there was no memory allocated to it.
Maybe what it wants is this: Not that it is NOT a pointer to pointer.

double ptr = 0; // <<<<< change this line
spe_in_mbox_ write(thread_args[i].spe_context,(uint32_t*)&ptr,SPE_MBOX...)
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Remember that the numbers start with 0, not 1. So if you enter 2 that is the third node -- 0, 1, 2

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You don't really need an iterator -- you can just index std::string just like you did the char arrays.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

At this moment I need to figure out how to read in a char array including the white spaces cause cin get() and even getline() all delimit at the whitespace when it comes to the gap on the answer

what?? I think you may be confused. getline() ignores spaces and stops reading then either '\n' is encountered or the input buffer fills up (assuming you are using character array).

is it possible to use a cast??

No.

maybe to take it in like a string but store in a char array cause the ifstream wont like me input like a string

This might be a lot easier if you would use std::string instead of character arrays

std::string answers;
std::string key;
std::string line;
ifstream in("datafile.txt");
getline(in, key);
while( getline(in, line) )
{
    answers = line.substr(0,15);
    name = line.substr(15);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I am trying to send the address of the ptr to another sub processor.

Huh? Are you using a PC or something else? You also need to post some code if you expect anyone to help you very much.


Here's my guess In C language just use the address operator

void foo(int ***variable)
{

}

int main()
{
   int** array = 0;
   foo(&array);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

wxWidgets is platform independent. Its available on both *nix and MS-Windows. And it's not a compiler, but a set of libraries that can be use with most any compiler. I suppose you are using g++ for the compiler with Eclipse.

>>and I don't really NEED the buttons etc.
You need to make up your mind about what you want. Do you want GUI or console text??

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just for the book i am applying a ton of compression techniques but lets just say for some reason we still can't be able to fit the entire structure onto main memory what would you do?

you might have at least a couple choices

  1. Use a 64-bit compiler which gives the program more memory. But that's won't help if the program already maxed out the computer's RAM.
  2. Swap the data to disk. This is a bad solution because it will be very very sloooooow.
  3. Replace the array with an SQL database table.
  4. Re-design the program so that it's not such a memory hog.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In c++ you can do it either way.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

use getline() instead of >> so that the entire line is read into a single variable.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is a space between "ma" and "mx". I know I'm going blind, but I'm not that blind yet :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

vc++ uses Forms it you create a C++/CLR project, which is Microsoft specific I think.

Here is a tutorial how to create a gui from pure win32 api functions.

Or you might try wxWidgets

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Look at line 1 of your original post

void maxmin(struct ma mx)
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Look at line 1 of your original post. That space will cause a syntax error so change it to whatever you want it to be.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

reverse the order of the first two parameters to memcpy(). Or x = *(int*)buf;

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
char buf[sizeof(int)];
int x = 1234;
memcpy(buf, &x, sizeof(int));

This might also work: *(int *)buf = x;

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And how can I pass them? Can you give me an example or anything cause I'm still new on this one.

Pass them just like you did the structure parameter. Declare the two variables in main(), then pass them by reference to maxmin() so that it can change the values, then pass them to minmax() so that it can use them. void maxmin(struct ma mx, int &min, int &max)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what makes you think an int is only 16 bits? Depending on your compiler, it might, but then again it might not.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Functions can not use variables that were declared in other functions. You have two choices: pass min and max variables as parameters or make them global so that all functions can use them. Passing as parameters is the preferred way to solve the problem.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

... if you remember using data cards and/or paper tape.

Yes -- I used paper tape on teletype machines in the 1960s.

If you remember computers that had vacuum tubes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I havent put the other code in for the other loops but i need to be able to count the amount that were correct wrong or missing

Well then just do it in one loop. Try to use as few loops as possible because they are very time expensive.

if( answer[i] == ' ')
   missing++;
else if( answer[i] == key[i] )
   correct++;
else
   wrong++;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

http://www.youtube.com/watch?v=LCAdotyM-Eo

Warning: contains GF violence.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>return *(--s1) - *(--s2);
That may give you the wrong result. It should be return *s1 - *s2; There are four possible return values

  1. If *s1 is '\0' and *s2 is not, then the return value will be some negative value.
  2. If *s1 is NOT '\0' but s2 is, then the return value will be some positive value
  3. If both *s1 and *s2 are '\0' then the return result will be 0.
  4. If neither *s1 nor *s2 is '\0' then the return value could be either positive or negative, depending on their values.

In either event, decrementing s1 and s2 before the subtraction may (and most probably will) produce the wrong result because s1 and s2 will not be pointer to the characters that cause the previous loop to terminate.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Adding the "." to your path is not a desirable way to fix the problem. It may work for you, but not for anyone else that tries to run your program.


>>How can I prevent the exec call from running other programs (located in the same directory)...Any ideas?
It won't. It only runs the program that's named in the first argument to that function.

Salem commented: Very true +19
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You don't need to know whether answer is 'T' or 'F'. Just test if( answer[i] == key[i]) You can then delete one of those two loops.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So guys, Can you please tell the output?? Which one you found out as the best one for C++?? I am also a C++ Beginner.

What output? Had you bothered to read this thread you would have seen that it's not about output, but about compilers.

Which one is best? The answer is: it depends..

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>inQuiz.seekg(0);//set position to begining of file

Delete that line. When the file is opened the file pointer will already be set to the beginning of the file.

>>inQuiz.seekg(1 - 1, ios::cur);
Why? what purpose does that serve?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Error. Can Not Find Keyboard
Press any key to continue

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

when you remember the 75 rpm music records -- or any records at all (I have not seen any for several years now).

Or when you remember MS-DOS version 1.0 and MS-Windows version 1.0.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Of course exe will not find "/program" when the program does not reside in the root directory. As I said previously you need to make it "./program". If you don't want to post actual code, that's ok, but will limit the amount of help any of us can give you.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 14 of CMain.h -- global objects can not be declared in header files because the compiler will try to create them in each *.cpp file in which the header file is included. Instead, use the extern keyword in the header file then in one, and only one *.cpp file declare the object without the extern keyword.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I miss the big bands on New Year's Eve -- TV used to visit all the major night clubs so that we could watch them all. Young people don't know how to party any more.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

my wife's home made potato salad for lunch.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

sarcasm? :)

No.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think a good time to have pasta would be during breakfast.

Any time is a good time for pasta :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm a big pasta eater, I love spaghetti, lazagnia and macaroni. Don't like cold pasta salads very much.

jephthah commented: no one cares +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Have you seen the movie 2012 yet? Its just a remake of the Noah's great flood story in Genesis.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Has my opinion changed? No. They're still all just a bunch of crooks and thugs. Do I regret voting for Obama? Yes, but I probably would have regretted voting for McCain too. Unfortunately, the recession changed all the rules for everyone. No one can foretell the future, so Obama and Bush tried to buy our way out of that situation. Whether it worked or not will probably not be known for several (or many) years.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It will not work with Turbo C because that compiler can not call any of the ms-windows library functions. As for borland, it depends on which version you are using. If its a 16-bit version like Turbo C, then that compiler will not work either.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just pass them to your functions something like I posted before. That code shows how to pass them by reference, meaning that additional memory will not be consumed like it is when passing something by value.

If you want to pass both structures, then add more parameters to the function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You didn't tell us the name of the structure or its contents, but basically something like this:

struct something
{
  // blabla
};

void foo( struct something& n)
{

}

int main()
{
   struct something s;
   foo( s );
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sorry for being 3 months late with this. Nice function -- a couple minor tweeks to make it run faster, but nice anyway.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Use a different IDE such as Code::Blocks or VC++ 2008 Express that generates the correct code for a windows application. MS-Windows applications are not supposed to have that console window in the background.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I realize I'm a little late in this thread. RGB() in windows.h is just a #define and as such you do not need to use any of windows libraries. Just put this in your program. #define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))) A COLORREF is nothing more than typedef unsigned long COLORREF; So, you could do something like

switch(RGB(20,30,40) )
{
    case RGB(20,30,40):
}
josolanes commented: I appreciate all your help!! Will try it with COLORREF +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Post the code that shows how you constructed the contents of that path variable and argv[] array of strings.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How unusual for a sig spammer. Last activity was this thread.

Huh? Who you talking about??

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

edlin was a really nice text editor for its time. I did all my C program using it for MS-DOS.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

put a dot in from of the / character, e.g. "./blabla"

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

@Dave: I didn't realize I had written a malformed sentence. Thanks for pointing that out. The word "nor" should have been "and". Ok I will accept the bad rep for that confusing sentence.

Both gets() and fgets() extract the '\n' from the keyboard buffer.

>>It is well known that fgets() leaves the newline in the stream.
It MAY leave it in, only if there is not enough room in the input buffer for it. But I KNOW you know that too :) But assuming the input buffer is large enough fgets() will remove the newline from the stream, which scanf("%s") and scanf("%d") will not. I suppose that was the point of my previous post.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you have an MFC program? Try CWnd::SetIcon() method. Not sure it will do what you want, but you can try it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Make sure you set the tab order of the objects in the order they should appear on the screen. If you use the IDE's resource editor to create the dialog box and its objects then its pretty easy to change the tab order.You might have to experiment a little with the tab orders to get them right.