Salem 5,265 Posting Sage

> would you be able to make me a basic program with an array that times
> 2 numbers from the array and shows it to the user
Why can't you create one, to explore the problem for yourself.
If you can get it to work, you might be able to figure out the answer to your bigger question.
If not, then at least you have something small to post here.

Salem 5,265 Posting Sage

Which OS/Compiler do you have ?

Where is the printer connected to your PC, serial, parallel, USB, network?

You say printf, are we to assume some kind of console program?

Salem 5,265 Posting Sage

Do a google search for "shunting yard algorithm".

Salem 5,265 Posting Sage

> Increment and decrement operations will be only perform after the end of a sequence point
No, they happen at any point between sequence points (therein lies part of the problem).
http://c-faq.com/expr/evalorder2.html
http://c-faq.com/expr/seqpoints.html

> therefore the increment of the first a++ is unexpected an the second it would only happen afterwards;
Again, this is also misleading.
Given a = f() + g(); there is nothing in the standard which says that f() MUST be called first. So you can't be sure that the left hand side value (with its side-effect) is "evaluated" first.

Salem 5,265 Posting Sage

http://www.daniweb.com/forums/thread99986.html
http://www.daniweb.com/forums/thread99863.html
http://www.daniweb.com/forums/thread99867.html
Guess what all these threads have in common?

Yes, that's right, they've all been " Last edited by moderator : 1 Day Ago at 01:46. Reason: Added CODE tags"

Salem 5,265 Posting Sage

Did you even bother to read the link I posted?
Parentheses ONLY modify precedence, they do nothing to evaluation order.

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

1. Throw out your fossil compiler.

2. Get a modern compiler, like visual studio express, or one of the many IDE's of MinGW (bloodshed, code::blocks)

3. Learn the C++ language first, before thinking about specialising into some particular application area. It's all very well having grand ideas, but if you haven't gotten much further than "hello world" in the scope of your programming knowledge, then you're going to be disappointed.

4. Visit http://nehe.gamedev.net/

Salem 5,265 Posting Sage

When you realise all such expressions are undefined, you can relax and get some sleep.
http://c-faq.com/expr/index.html

> But when i am assiging the result of that expressiion in any variable then i got 0 value
That's one of the hallmarks of undefined behaviour, change anything at all and the result changes for no good reason.

If someone is teaching you this stuff, they're an idiot.

Salem 5,265 Posting Sage

In a loop which runs 12 times, you want

cin >> temps[0][col];  // this is max
cin >> temps[1][col];  // this is min
Salem 5,265 Posting Sage

> Any Idea for a project in Web Aplications?
Well you could write a detector for useless bumps of dead threads on forums.

It seems the world is full of students incapable of independent thought.

Salem 5,265 Posting Sage

Perhaps post your 'bt' trace?

Salem 5,265 Posting Sage

57 64

Salem 5,265 Posting Sage

Great, you've got your free cookie, but have you learnt anything in the process?

> I definitely never would have been able to do it on my own.
Sure you would, eventually.
But instead you're dazed by vijayan121 'brilliance' rather than building up your knowledge towards your own solution. Which whilst it might have been longer, used less C++ features, would have been YOUR solution and not someone else's.

iamthwee commented: well said +13
Salem 5,265 Posting Sage

Use a string stream to create a filename, like so.

#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;

int main()
{
    ostringstream fname;
    int        T = 22;
    fname << "results.xls_" << T << ".xls";
    cout << fname.str() << endl;
    ofstream outfile(fname.str().c_str());
    outfile.close();
    return 0;
}
Salem 5,265 Posting Sage

> The string i am sending is also not longer than 512 bytes.
But what about it's length after formatting?

Try something like

char temp_str[10000];
vsprintf(temp_str,arg,ap);
if ( strlen(temp_str) >= 512 ) {
  fprintf(stderr, "I was wrong\n" );
}

> Im using multiple threds , which calls this makeLog function.
If you linked with a multi-thread library, that shouldn't be a problem

When you say 'core dump', are you referring to the Linux/Unix core dump?
Because then you can load the core file into gdb and use the 'bt' command to give you a stack trace of where it stopped.

If that stack trace shows that vsprintf() was in turn calling malloc/free, then you have a much bigger problem to solve. You've trashed the memory pool and this is merely the symptom of the problem, not the cause of the problem.

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

When you say "image", you're referring to a copy of all the sectors of information stored in the memory card right?

And not reciting the tale of someone told to make a copy of the floppy disk by putting it on the photocopier :)

Salem 5,265 Posting Sage

> You must hand in your work by the 10th of December 2007 to the Undergraduate Office.
Please post the email address of your assessor so that we can be sure of timely delivery of the assignment to the correct place.

Salem 5,265 Posting Sage

Did you see this thread at the top of the forum?
http://www.daniweb.com/forums/announcement118-3.html

Did you see the watermark at the back of the edit window?

Salem 5,265 Posting Sage

Yeah, and this thread was 3 years old before assorted "chippies" came along with their "me too" responses.

Salem 5,265 Posting Sage

What?

Write some code to read a .cap file, extract a frame and show usage of the bitwise operators to extract some information?

Go read your C book or some tutorials to find out how they work, then try to use them in your application. Then (or if) you get stuck, then you can post some code and we'll see if we can help you past your difficulties.

Yes I can help, but I'm not going to spend the next hour researching .cap files, saving a trace with ethereal and then writing some code just so you can grab it and say "tada, finished". It's your project, start pulling some weight.

Salem 5,265 Posting Sage

> But then you're only willing to help people because you get points out of it
So we have now 4 "metrics" which tell the world how we're performing, yet none for those people asking the questions?

As you well know, I also help out on cprogramming.com, and there is no rep there at all, so I'm definitely not in it for the "points" as you put it.

If they have a high post count, they might have a clue.
If they have a high rep, they might have a clue.
If they have a high number of "solved" threads, they might have a clue.
If they've been here a long time, they might have a clue.

If none of this matters, why show it?

Sure, if "solved" is a metric, I'm going to be more interested in helping people who post with code tags in proper English, and give due recognition rather than some brain-dead semi-literate boob who doesn't give a damn so long as they get their free lunch.
We all have a limited time here, so I want to make sure that my effort is duly recognised.

One way is to "reward" those responsible posters by answering their questions
a) first
b) in more detail.
If I run out of time, then the also-rans will either have to wait, or improve. Without any incentive, why would they ever bother to …

Salem 5,265 Posting Sage

Perhaps you should begin with some exercises which get you used to using these operators
^
&
|
>>
<<
~

Use fread() to read one or more bytes from the file,
Use the bitwise ops to extract the bit(s) which interest you.
Use the information in the file format specs to guide you.

Salem 5,265 Posting Sage

Our normal definition of "help" is that you make an effort to produce some code, then we help you with whatever it is you're stuck on.

Your definition of "help" seems to be you post your assignment and then wait for someone else to do the work.
Read the intro threads - no free homework without some effort on your part.

Salem 5,265 Posting Sage

So what's the problem?

Have you read the relevant documentation to learn about the .cap file format?

Are you able to open and read the file, and retrieve a packet?

Are you able to decode the header of that packet to determine it's purpose?

Salem 5,265 Posting Sage

How about the other "incentive" of working out which people are worth helping?

If two posters have started 100 threads (say), where one of them has marked nearly all of them as "solved", and the other hasn't even bothered, then I'd like to know.

Salem 5,265 Posting Sage

Well they need to be implemented SOMEWHERE.

My guess is since you've prefixed it with 'my', then it's your responsibility to implement it.

Salem 5,265 Posting Sage

Look up pthread_exit() and pthread_join() for ways of communicating information from the thread back to the parent.

Salem 5,265 Posting Sage

> Should I use structures?
Yes, it's certainly a lot more convenient than using lots of arrays.

Salem 5,265 Posting Sage

Probably, but I really couldn't care less until either you or a mod fixes the post so that I can read it without going blind in the process.

Salem 5,265 Posting Sage

Look at the "branch" bit coming out of the control bubble, and how that affects the MUX in the top right corner of the diagram.

Salem 5,265 Posting Sage

And which processor / assembler are you thinking about?
This isn't the psychic programming network, we've no idea what you're referring to.

Salem 5,265 Posting Sage

Sure, figuring out how to use code tags would be high on your list.
You were a lot closer than most people manage, but you still didn't make it.

Salem 5,265 Posting Sage

So do you have a mywindow.cpp which implements the rest of the functionality of your class in mywindow.h ?

Salem 5,265 Posting Sage

> this is urgently needed
I'm sure it is, but that isn't my problem.
http://www.catb.org/~esr/faqs/smart-questions.html#urgent

Nor am I interested in people in too big a hurry to read the forum rules, and completely ignore the copious references to USE CODE TAGS all over the forum.

zandiago commented: Want to establish a reading school? +2
Salem 5,265 Posting Sage

So goto http://sourceforge.net and type "partition" into the search box.
Plenty of open source examples to get your head around.

You'll need a machine you won't mind trashing several times, because in your stumbling around in the dark, you will completely trash your HD and make it unbootable and unrecoverable.

Salem 5,265 Posting Sage

http://clusty.com/search?query=PCB+cleaner

The first thing I would suggest you do is carefully remove the HD and put it in a really safe place, or find a similar machine to plug the HD into so you can get some backups done.

Observing correct ESD precautions whilst working would be paramount to avoid further damage.

The best bet would be to find someone who offers a "no fix, no fee" repair service, or at least gives you a free estimate up-front.

Salem 5,265 Posting Sage

This should help you with your parallel port programming.
http://www.lvr.com/parport.htm

Jicky commented: that was a very useful link +1
Salem 5,265 Posting Sage

So there's nothing virtual about it, it's just hidden ?

Salem 5,265 Posting Sage

Have you considered storing all your init data in an XML file instead?
There are libraries to support XML, and plenty of tools to deal with XML.

Salem 5,265 Posting Sage

Gah, more cross-forum posting :icon_mad:

Salem 5,265 Posting Sage

Not bad, apart from
- void main
- using conio.h
- using clrscr()
- using getch()

> for(i=0;i<=index;i++)
It should be <, not <= if you want to count 'index' elements (you start at 0, not 1).

Salem 5,265 Posting Sage

How do you expect us to give you code, when you have the algorithm?

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

Well there's this - http://www.daniweb.com/forums/announcement118-3.html
So that people might care enough to look at your code rather than just dismissing it as an unreadable mess.

Salem 5,265 Posting Sage

Whenever you have an array, you need to be thinking about using a for loop as well.

Salem 5,265 Posting Sage

Don't start multiple threads on essentially the same topic.

Salem 5,265 Posting Sage

http://www.daniweb.com/forums/announcement8-3.html
So when you post code, it looks like this.

int main()
{
    int x, n=0;

And not like this.
int main()
{
int x, n=0;

> is there any way to make it shorter?
Of course there is, but that's not necessarily a good measure of "success" for a program. Doing the right thing, and being easy for the average programmer to comprehend without too much effort are good qualities to strive for IMO.
Coming up with some crazy one-liner might take me an hour, and you a few days to comprehend what's going on, but it still won't teach you anything.

> #include <iostream.h>
> #include <conio.h>
These are obsolete header files.

If your C++ compiler won't accept

#include <iostream>
using namespace std;

then you need to update to something more modern.