Salem 5,265 Posting Sage

So is that when you use for(int i = 0; i < len; i++) rather than for ( string::size_type i = 0; i < len ; i++ ) {

Salem 5,265 Posting Sage

How about posting your attempt.

Rather than just describing to us rather unconvincingly that you've made any attempt at all.

We get a lot of "I tried but it didn't work, here's my question, can you do it for me, kthxbye" types.

Salem 5,265 Posting Sage

Sure...

do {
   read( "http://www.daniweb.com/forums/announcement9-2.html" );
while ( comprehension < 100% );
Salem 5,265 Posting Sage

You could always try for( i=0;i<20;i++) and observe the error messages

Maybe then try

int i;
for(i=0;i<20;i++)
Salem 5,265 Posting Sage

> how would i do that?
Why is also a question as well.

Are you figuring that if you can assassinate your parent, that you'll be adopted by root?

Salem 5,265 Posting Sage

> for (i=0;i<3;i=i+2)
> for (j=0;j<3;j=j+2)
i is 0 or 2
j is 0 or 2
You're just printing the corners of your matrix.

Try a different loop.

Salem 5,265 Posting Sage

> while(i = 1)
Maybe it now loops forever, rather than previously not looping at all?

Try while(i [B]==[/B] 1) Or better

bool finished = false;
while ( !finished )

Then at the moment in the code where you have finished, write finished = true;

Salem 5,265 Posting Sage

Weird - your printf statement looks exactly the same, except for the fact that you said you changed it.

Thanks for playing.

jephthah commented: i feel your pain +7
Salem 5,265 Posting Sage

Well if you added
printf(" %d is larger %d","apple","banana");
then yeah, that wouldn't work either.

Post your ACTUAL CODE if you want an actual answer to what you've done wrong.

Salem 5,265 Posting Sage

> char a[10][25];
> char *ptr_a;
> ptr_a = (char *)a[10][25];
If you really want to do this with pointers, then it's

char a[10][25];
	char  (*ptr_a)[25];
	ptr_a = a;

Then you should be able to use strcpy( ptr_a[index], argv[index] );

Salem 5,265 Posting Sage

Is that binary supposed to mean something?

Because it means diddly-squat to us.

Perhaps you should read the instruction encoding manual for whatever processor you're using (real or simulated).

Salem 5,265 Posting Sage

> printf(" %d is larger %d");
How many extra parameters do you think printf needs here?

Salem 5,265 Posting Sage

gdb just shows you where it crashed - inside some internal routing of scanf.

Use the bt command to see the stack trace, and 'up' and 'down' to navigate the stack until you get to a line of YOUR code.

Then examine the variables.
i is a good bet for being out of range of your array.

WaltP is almost certainly right, you walked off the end of your array with your while true loop.

Try while ( i < DIM_DICT ) instead.

Salem 5,265 Posting Sage

Perhaps you could paste your current output, and maybe use say the bold or the red to pick out the parts of the output you consider to be wrong, and what you think the right answer should be.

Sure I can run the code, but how would I know what YOUR correct answer is going to be?

Salem 5,265 Posting Sage

*unsort = malloc(sizeof(char)*strlen("\\!Unsort"));
strcpy(*unsort, "\\!Unsort");

Yeah, you need to malloc (strlen(foo) + 1 ) bytes to copy a string foo.

The fact that it works with certain strings (and it's still wrong) just makes you lucky.

Salem 5,265 Posting Sage

Did you compile it?

I mean this is 6 hours later, and it's at best a 30 second job to write a few line test program to see if you can do
Real myvar = 1.0;

Salem 5,265 Posting Sage

http://www.daniweb.com/forums/announcement8-2.html

If you don't even understand the question, then go and talk to your tutor.

If you're stuck on part of the answer, then post some relevant code and ask a question about that code (in the context of your problem).
Eg. I think I need a list of bids, but my list keeps dropping the latest bid. Here is my code.


Don't just dump your assignment fresh from the email message from your tutor then sod off down the beach or something, expecting us to take up your slack - it ain't gonna happen.

Salem 5,265 Posting Sage

Are you sure you have a hard tab (not just leading space) before your compiler command line?

Makefiles are very fussy on this issue, and if it isn't an actual target command, then it might be being interpreted as a rule expression instead (specifically, -o would be 'or' )

> it indicate no line of where the error is located.
No, it says command line.
So it's not IN your code, but just before you get to it.
Look at your makefile, and the command lines it generates.
Consider the various make debug options to make it show more information.

Salem 5,265 Posting Sage

Meaning, when you've rearranged the shop layout, how long will it take us to figure out where the tins of spam are stored?

Salem 5,265 Posting Sage

> The prize is full marks to the OP if he can convince some rube to help him cheat on his homework.
Not to mention, also convincing the rube doing the marking that this sudden masterpiece of a program from the class laggard is actually their own work.

I think we should all have a go at this homework.
http://www.daniweb.com/forums/thread281359.html
It comes complete with a submission email address (handy that, cuts out the middle).

Salem 5,265 Posting Sage

Yes, use fgets() to read the whole line, then sscanf() to parse it.

If the line is rubbish, then you've already cleaned up the input stream to have another go.

Salem 5,265 Posting Sage

In my time off, I like to collect spammer addresses whilst putting the finishing touches to my latest toy.

The ICE Man commented: LoL :) +0
Salem 5,265 Posting Sage

Here's why your "I want" is going to fall on deaf ears.
http://www.daniweb.com/forums/announcement61-2.html

If you want it badly enough, make an effort.

Otherwise, just drop the course now and stop sucking the life out of whatever class you're in.

kvprajapati commented: Well said. +9
Salem 5,265 Posting Sage

Break it into steps

1. Find files

cd /root/projects
find PROJECT* -type f > $HOME/allProjectFiles.txt

Gets you something like this

$ cat $HOME/allProjectFiles.txt
/root/projects/PROJECT01/date/JAN2000/output/SAMPLE0001/TARGET_102932
/root/projects/PROJECT02/date/JAN2001/output/SAMPLE0002/TARGET_32323
/root/projects/PROJECT03/date/JAN2001/output/SAMPLE0003/TARGET_32999293

2. Extract ones of interest $ awk -F'/' '$6 ~ /JAN2001/' $HOME/allProjectFiles.txt > $HOME/selectedProjectFiles.txt Now you can make the condition in red as complicated as you want.
You can match literal strings, or regular expressions. $2 == "PROJECT01" && $6 ~ /JAN200[0-4]/ being the PROJECT01 files for January for the first half of the decade.

3. Copy files $ cat $HOME/selectedProjectFiles.txt | while read line ; do echo cp $line ${HOME}/TMP ; done When you're happy that the printout of copy commands looks good, just delete the echo and it will actually do the copying.

Salem 5,265 Posting Sage

Post your latest code.
Mostly when noobs describe they've fixed something and it doesn't work, they haven't actually fixed it at all.

Salem 5,265 Posting Sage

> 2^64
This is 8 bytes into your array, and the 2^32 is 4 bytes in to the array.

But isn't the overall result 128 bits in total?

Salem 5,265 Posting Sage

Are you trying to make me believe you got the ; in the right place?

The only thing I would do with that code is press CTRL-A then press DEL.

Salem 5,265 Posting Sage

> The error states:The program '[3716] Lab02 Case01.exe: Native' has exited with code 0 (0x0).
This means your program exited successfully (ie, it didn't crash).
Whether it did what you want is another matter, but at least it compiles and runs.

> 'Lab02 Case01.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
> 'Lab02 Case01.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
These are just warning you that IF you wanted to debug right down into the kernel, that you would have a hard time.
As a newbie, it's not something you'll be doing any time soon, so it's not worth worrying about.
It doesn't affect your program's ability to run.

Salem 5,265 Posting Sage

How about posting your latest code, not your latest ASCII art rendition?

Then we can tell you exactly what you did wrong.

Or are you hoping that if you roll around helpless for long enough that someone will spoon-feed you the answer?

It's a choice, but it basically boils down to whether you want to learn or not. At the moment, votes favour the "no" side.

Salem 5,265 Posting Sage

Undoubtedly, you're just spamming crap all over the net just for your crap-assed sig-links
http://www.google.com/#hl=en&source=hp&q=%22Undoubtedly%2C+technology+problems+hold+you+and+your+company+back%22&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=a86c207b1c79523e
The thread is 8 YEARS OLD - how relevant does that make anything you have to say?

Salem 5,265 Posting Sage

How's your eyesight?

A bit fuzzy round the edges perhaps with looking at too many *'s (they're dots actually).

No?
How come you missed this then?
http://www.daniweb.com/forums/announcement9-2.html

Salem 5,265 Posting Sage

Read this
http://www.daniweb.com/forums/announcement9-3.html

And get some sleep - trust me, your last few hours of coding will look pretty bone-headed in the morning.

Salem 5,265 Posting Sage

I'm guessing it begins with

int numChildrenInThisNode;
nodes *children[4];

When numChildrenInThisNode is 4, do something!

Salem 5,265 Posting Sage

http://sourceforge.net/apps/mediawiki/cpwiki/index.php?title=Indentation
Unreadable code perhaps?

I struggled through the spaghetti, and you might be missing a ; at the end of your class.

Salem 5,265 Posting Sage

I guess they mean this
http://en.wikipedia.org/wiki/Finite_automata

But the question is too weak to give it much attention at all.
Even this is pushing it.

Salem 5,265 Posting Sage

Load first map from file
Play level
Load second map from file
Play level

If loading a map takes a few seconds then
Load first map from file
Play level
Display some static image and play "tension" music in the background
Load second map from file
Play level

jonsca commented: Rep for recommending the "tension" music -- good touch +4
Salem 5,265 Posting Sage

> I got 3.13!
I got 3.1415926535897932384626433832795
I found the test as easy as pie ;)

Salem 5,265 Posting Sage

> int dataLen = recv(client, recvBuffer, 1024, 0);
You're assuming several things (all of which are false, eventually)

1. That for every "message" sent, you get "message". STREAM sockets can fragment the message (only the byte order is guaranteed). So you might get "mess" or even "messagemessageme".

2. That every message has a \0 (to make it a proper string). If you don't send one, then there isn't one added automatically.
Typically, this means using sizeof(buff)-1 in the recv call to allow for easy appending of a \0 if you need to.

3. Use the length before doing anything else with the message.
len = recv....
if ( len > 0 ) buff[len] = '\0';

Then you can treat buff as a proper c-string.

iamthwee commented: Good ol' fashioned advice, full of that ying yang goodness. +11
Salem 5,265 Posting Sage

Well if you showed us how you declared and initialised your array, then we could tell you how to pass it to a function.

Hint: just copy/paste the original declaration into your function prototype.

Salem 5,265 Posting Sage

> while (elements[j] > elements[j+1])
j starts of as n-1, which means j+1 is actually n (which is also off the end of the array.

Also, what's stop the j=j-1 going negative?

Salem 5,265 Posting Sage

So why can't you recursively evaluate A -> B -> C ?

a1 = eval( eval(a2) + eval(a3) );

When you get to a3, you see that you need to do another eval()

Is this a plan?

The only problem you need to watch out for is if there is a cycle in the expressions.

Salem 5,265 Posting Sage

Well how you fix it depends on what you're trying to achieve in the first place (we can't tell from 2 lines and an error message).

This should work (but is it what you want?)

char  defaultmessage[]="hghgghjgh";
char *message=defaultmessage;
Salem 5,265 Posting Sage

> while(nextPermutation(elements,n));
But you marked the function as returning void.

You need to return a value indicating if there are more permutations.

Salem 5,265 Posting Sage

> pSinglePoint = &next;
Two things wrong here.
1. You're attempting to point from inside the class, to some outside the class. A class object should be a self-contained entity. Having invisible dependencies to the outside world is a recipe for disaster.
2. You're actually storing a pointer to the local parameter, NOT the original in main.

Salem 5,265 Posting Sage

Nope, not me.

Salem 5,265 Posting Sage

Well for a theory answer, it looks OK (well it has the general components I would expect for solving the problem).

Do you have a real CPU you can try your code on?
Do you have an emulated CPU you can try your code on?

Salem 5,265 Posting Sage

> is this solution correct?
Try it yourself perhaps?

Salem 5,265 Posting Sage

That's a spectacularly useless manual page AD.

Not only is there no %n, there's no %i %p or %[ either.

http://linux.die.net/man/3/scanf
Which includes all the ones new for C99 as well.

Salem 5,265 Posting Sage

*shrug*
I just threw in some crumbs to show the general idea of how the problem was solvable.

Tarting it up for security and suitable for compiling with whatever C.X.Y compiler was left as an exercise for the readers :)

Aia commented: You know what it is said about "Do not throw pearls before swine". But crumbs are OK. ;) +8
tux4life commented: Oh, okay, maybe I "overreacted" a bit. +8
jephthah commented: "tarting it up" ... that will be my new phrase +7
jonsca commented: I left my English to English dictionary somewhere... +4
Salem 5,265 Posting Sage

Have you considered the security implications of giving the world and its dog complete and unfettered access to your system?