Salem 5,265 Posting Sage
Piya27 commented: nice programming language ;) +1
Salem 5,265 Posting Sage

Good, so now use the debugger to examine your program state to try and figure out how it got into that state to begin with.

Then you can think about what code changes are needed to stop it from getting into the error state.

Nick Evan commented: Yes +22
Salem 5,265 Posting Sage

For me, the basic problem is one of size.

Ordinarily, in a properly functioning Capitalist system, failing companies would be allowed to fail.
This either solves the oversupply problem (so that the remaining companies in the same market will survive), or it creates a gap in the market where new entrepreneurs can step in and make a go of it themselves.

1000's of small and medium sized companies are going through this natural process, but there's no government piling up debt for the next couple of generations' on some foolish gamble.

If government wants to regulate, then it should consider the following statement.
"If this company were to fail, would we (the govt, and hence the people) be under any imperative to step in and bail them out?"
If the answer is anything other than a categorical "NO!", then the company is, BY DEFINITION, too big.

That means properly keeping a watch on mergers, and forced divestment if it simply grows too big.

I'm sure some hardened nuts will whine of about "the economies of scale", which is all very nice when things are going well. But when it all goes wrong, we're all footing the bill by a hell of a lot more cash than any illusion of savings before then.

Besides, these monstrously large companies are practical monopolies, so they only really benefit the directors and shareholders. Anything you would have saved as a customer is swallowed by price …

John A commented: Couldn't have said it better myself :p +21
Salem 5,265 Posting Sage

> thank you...hope you can help me with this... I need it tomorrow...
But tomorrow is Thursday.

I'm Robinson Crusoe, and all my work is done by Friday ;)

tux4life commented: ROFL +17
Salem 5,265 Posting Sage

So who did you copy that code from?
That style of C has been obsolete for 20+ years.

Ancient Dragon commented: Yikes! :) +36
Salem 5,265 Posting Sage

That's going to be awfully confusing to users.

I mean, they type in the 3rd letter say, think they've got it wrong and look at the screen to see 4 stars.

What do they do next, press delete twice I wager and make a bad situation worse.

scru commented: Programmers rarely think about ux. +6
Salem 5,265 Posting Sage

Vote for me, and I'll delete on sight all those useless "project title" threads which pollute the forum, which never go anywhere useful.

> You don't have to be here long to learn the nature of this site.
Narue is the nature of this site down to a 't' ;)

Nick Evan commented: Delete 'm all I say! ;) +22
Salem 5,265 Posting Sage

> Thank you for the idea but could you explain a little further
Yes, and I bet your tutors will ask you exactly the same question as well.

The only difference being is that your explanation will be even more vague than whatever is posted here.

That's what you get when you can't think for yourself (it's an endemic problem on this forum for some reason). I suppose it's all those dumb "final project" searches people type in, and look, daniweb.com is at the top of the list. In they trudge, post yet another "final project" thread and thus further "improve" DW's rank in google and the whole vicious cycle continues.

Quite how you got to your third year without having to think, or much less being inspired along the way with "hey, this would be an interesting project" is beyond me.

cgyrob commented: Very good point. +1
Salem 5,265 Posting Sage

Banned, Ostracised, is there a difference?
Only in the colour of the pebbles one accumulates ;)

ddanbe commented: You are broadening my knowledge on ancient Greece! +7
Salem 5,265 Posting Sage

@yellowSnow
And if fgets() returns NULL because of an error (and not because of end of file), then what?

tux4life commented: Yup! +18
Salem 5,265 Posting Sage

Don't use feof() to control a loop

Use while ( fgets(buffer,sizeof(buffer),myfile) != NULL )

tux4life commented: I was already wondering when someone would tell him :) +16
Salem 5,265 Posting Sage

If you haven't done so already, make sure you've got a backup of all your work, and copies of any non-standard drivers you might need, whilst you're still able to boot to normal mode.

Next, do you have the original boot CD for your OS?
You'll need it to run the recovery console, in order to do this:
http://answers.google.com/answers/threadview?id=215902
Try fixing the Master Boot Record with FIXMBR, then see if CHKDSK will run.

Failing that, I would guess running the "Repair" option from the boot CD would be worth a shot.

Salem 5,265 Posting Sage

Or get a real compiler!!!!

> this is to be used in my skool project...n i asked my teacher n she said u cant use allegero,fastgraph or ne other compiler
Scratch that, get a real teacher instead.
They don't know C any better than you do. They "learnt" some tricks for TurboC 20 years ago, and are now too scared to update to another compiler because all that they know is in fact useless.

Which in turn means that all that YOU will know will in fact be useless.

tux4life commented: Agreed! +16
Salem 5,265 Posting Sage

> "Because I feel like it" is as valid a reason as "because the standard says so".
How about "I want my programs to work" vs. "My programs work by magic so long as I use the codemangler 3.0 compiler".

Why stop there?
char *str ; gets(str);
usually had a pretty good chance of success, for DOS programmers.
Does that make them good, or just lucky?

Something else you might want to consider.
If you thought learning C was hard the first time around, just try unlearning a bunch of crap C because you new codescribbler 4.2 compiler complains about all sorts of things, and the OS just lays your program out cold whenever it touches an illegal pointer.

Do you?
a) re-learn a bunch of compiler specific tricks for each new compiler.
b) learn ANSI-C and stop worrying about when the next incompatibility is gonna bits your ass.

I did "a" exactly once, and it sucked!

Oh, and it's not just hypothetical waffle.
http://users.aber.ac.uk/auj/voidmain.shtml
At least one REAL machine barfs on void main.

Do you think all this internet stuff works because
a) everyone followed the standards
b) everyone did their own thing which "worked for me" in their own little corner of the universe.

Or how about two banks transferring money. Bank A sends it in hex, and bank B receives it in decimal, do you
a) congratulate …

MosaicFuneral commented: lol, Good stuff. +6
scru commented: Man you're a killjoy! -1
John A commented: We have a winner! +21
Salem 5,265 Posting Sage

Do you think professionals spend all of their time scouting round the net for a tutorial on how to solve their next work assignment?

Perhaps you've been having an easy time of it, thinking that you can actually program when in fact all you can do is follow tutorials and make a few tweaks.

Programming is HARD work when you have to create it yourself.

TBH, it might take you 6 months to get your animation working just right, are you ready for that prospect?

There's a whole bunch of OpenGL tutorials here
http://nehe.gamedev.net/

Salem 5,265 Posting Sage

Sooner or later, you need to realise that there isn't a tutorial for everything which just matches your needs.

At which point, you have to get down and start trying (and failing) to do your own thing (and not follow someone else's recipe).

You're almost certain to fail at your first attempt, but you're going to learn a HELL of a lot more from the experience than simply following in the footsteps of someone else (who may not even know the way).
You shouldn't look on this prospect in a negative way, it's a great teacher.

Only then will you become a truly creative programmer.

siddhant3s commented: Amen +16
Salem 5,265 Posting Sage

Are you going to spend more than say 5% of your time on this "protection", compared to the time you've spent on the actual product?
If "yes", perhaps you need to reconsider your priorities.

Is your product bug-free?
If "no", perhaps you need to reconsider your priorities.

Spending excessive amounts of time to "project" buggy software won't make people any more willing to buy it even if they like the general principle of the program.

MosaicFuneral commented: Well said. +6
Salem 5,265 Posting Sage

Poster evaluates to a thread posted on two forums.

kvprajapati commented: Great eyes! +7
Salem 5,265 Posting Sage

I'm gonna bookmark this thread so I can refer to it, when your next question would have been solved by reading the error messages.

tux4life commented: Good point :) +15
Nick Evan commented: Haha +22
Salem 5,265 Posting Sage

Well to be pedantic again, you should have written
const char *p="abc";
then the compiler itself would have complained about the attempt to modify a constant.

Because so much existing code (prior to C89) used this construct before the idea of putting "strings" in read-only memory came along, it was generally decided that it was better to not complain about the loss of const in such pointer assignments.

If you use some other type apart from char, it should really complain about the loss of const.

lighthead commented: nailed it! +2
Salem 5,265 Posting Sage

> NOte that here break 1 (p++) and break2 (*p++ ) doing the same thing.
Better add someone else to the reading list....

No they're not the same, one merely increments the pointer, the other one ALSO dereferences it at some point.

The second being equivalent to someImaginaryDummyWhichGetsThrownAway = *p++; A good compiler would have warned about a discarded result.

Oh, to be pedantic, you print a pointer like this printf("string:%s and address:%p\n",p,(void*)p); The rest of your analysis is wrong as well.
There is nothing wrong per se with ++*p++, so long as p is pointing to memory which can be MODIFIED. The original error was because p was pointing to read-only memory, and has nothing to do with the syntax of the expression being faulty.

John A commented: Bingo. +21
Salem 5,265 Posting Sage

It seems that most people other than Tom Gunn need to swing by here and have a nice long read.

http://c-faq.com/aryptr/index.html

tux4life commented: :$ +15
Agni commented: Nice Link !! +4
Salem 5,265 Posting Sage

> char *p = &q;
Did you try it?

&q has a different type to q, so any good compiler would complain about incompatible pointer assignments.

jephthah commented: keeping me honest :) +12
Salem 5,265 Posting Sage

The first ++ tried to modify what p points to.
Since p points to a string constant, your program dies because it tried to modify something in read-only memory.

Salem 5,265 Posting Sage

> i wrote the whole program but there is some mistakes
And until you adopt a better approach to writing programs, the same mistakes will keep arising.
http://cboard.cprogramming.com/c-programming/88495-development-process.html

DO NOT try to write the whole thing in one edit, press "compile" whilst sacrificing some animal to the programming gods, then posting on a message board "it doesn't work".

Fixing code is a basic skill, learn how to do it.

Ancient Dragon commented: Great advice :) +36
Salem 5,265 Posting Sage
tux4life commented: The broadest answer I've ever seen :P +13
Salem 5,265 Posting Sage

Next step is to read the documentation for "Speech API".
Then try some examples from the documentation to test your understanding.

Ezzaral commented: Sounds about right to me. +24
Salem 5,265 Posting Sage

So start with what you know now, and make a better design.

Basic 1:1 substitutions of your 10 year old code might make it run, but it will still look like 10 year old code when you're done.

Sooner or later, all code reaches it's "compile by" date, at which point the only sensible thing to do is freeze it "as is" and start again.

Sure, you can read it for some good ideas to see if they're still relevant, but to actually edit it to make it work - that's probably not a good idea.

tux4life commented: Good advice :) +12
Salem 5,265 Posting Sage

Only that strdup() isn't a portable function.

Salem 5,265 Posting Sage

We did all this less than a month ago.
http://www.daniweb.com/forums/thread198087.html

Nick Evan commented: We didn't brag about our systemspecs in that thread :) +21
tux4life commented: How could I forget :P +12
Salem 5,265 Posting Sage

http://forum.piriform.com/index.php?showforum=19
I'm guessing that's where you'll find the highest concentration of experts and users for that product.

Salem 5,265 Posting Sage

I see the OP got their wish by successive approximation without having to put in any more effort.

Congrats to all :icon_rolleyes:

tux4life commented: ROFL :P +11
Salem 5,265 Posting Sage

If I say 'yes', will you go for it?
If you then fail, will you blame me?

Your question (like all the "please suggest a project" posts on this forum) is essentially unanswerable.

The sheer inadequacy of the way people summarise the last 3 years of their education baffles. The lack of ... (aww forget it, I've got other things to do)

It's like walking into a shoe store, and you're asking us for advice on what's the best thing to have for running a marathon. Sure, we can describe in nauseating detail everything about running shoes, but some people will STILL manage to walk out the store with a pair of stiletto heeled shoes.

Nick Evan commented: You're right, it's a waste of time +19
Salem 5,265 Posting Sage

http://www.daniweb.com/forums/announcement8-2.html
And we need you to make an effort to solve your own homework, which is more than just cross-posting

VernonDozier commented: Caught yet another cross poster. +17
Salem 5,265 Posting Sage

What is your C++ question?

tux4life commented: A thread with no question :P +10
Salem 5,265 Posting Sage

A thermal imaging camera pointing at the departmental coffee machine, complete with a web interface.

The image analysis estimates the volume of coffee and it's temperature.

Users can 'subscribe' their preferences, and get alerts when their preference happens.

danishbacker commented: good idea for a school project +2
momoryoma4488 commented: can you help us in our thesis??? the language that we are allowed to use is Java... but honestly... we are not that good in java... I hope you can help us... +0
Salem 5,265 Posting Sage

> void main()
Mentioned before, so I'll mention it again.
main returns an int, not void

> total=total+a;
Is the initial value of total zero?

tux4life commented: Yes, that was also getting on my nerves :) +10
Salem 5,265 Posting Sage

> So if you cannot put here at least 1000 memorable moments of your life, you better start thinking of throwing yourself under a train.
999 - replying to this thread.
Oh bugger.

Salem 5,265 Posting Sage

Multiple personality disorder?
http://www.daniweb.com/forums/thread199504.html

Or just everyone in the same class?

kvprajapati commented: Great eyes +3
Salem 5,265 Posting Sage

When you do post your code, don't forget to tell everyone else

VernonDozier commented: Caught yet another cross poster. +17
siddhant3s commented: Eyes of a Hawk +13
Salem 5,265 Posting Sage

At the risk of being seen to pander to "urgent" requests by posting in a timely (from the OP's perspective).

http://en.wikipedia.org/wiki/Feistel_cipher

Of course, being able to spell "cipher" properly is a good idea, it helps so much when it comes to typing things into a search engine.

Nick Evan commented: It's spelled "syhpher", right? :) +19
Salem 5,265 Posting Sage
csurfer commented: Super catch man !!! You do it all the time :) +2
Salem 5,265 Posting Sage
VernonDozier commented: Good catch. +17
Salem 5,265 Posting Sage

error: ‘struct std’ redeclared as different kind of symbol
<built-in>:0: error: previous declaration of ‘namespace std { }’

So pick a different name, one which isn't the name of the STANDARD namespace, and get on with life.

You can never use 'std' as a struct name, even if some current compiler lets you get away with it.

tux4life commented: Good clarification in this thread, who the hell comes on the idea to create a class named 'std' :P +9
Salem 5,265 Posting Sage

> Can anyone help me or guide me with the code please?
Not a chance.
It's quite obvious that you wrote neither one of them, and that you just happened to "find" them as a result of a web search.
For a start, the 2nd one looks a decade older than the first.

Further, since you've spammed so many forums, the chances are high that whatever we say here will be said somewhere else as well. I for one am not going to waste any more time on you, repeating what someone else may have written. I'm certainly not going to check all the cross-forum sites just to make sure I'm not repeating what someone else wrote.

Lastly, constant whining "help me" without you making an effort just puts everyone off.

Try writing your own code, not begging for other people to hack together something you found.

jephthah commented: shazam! +11
Salem 5,265 Posting Sage

> I did find your other posts here and here, to be of some interest.
Aww man, you beat me :(
I could only find one other cross-post

tux4life commented: Is the OP going mad? :P +9
Salem 5,265 Posting Sage

Ads are there to see who's smart enough to figure out how to get rid of them.

WaltP commented: Ahhh, that makes sense :) +20
Salem 5,265 Posting Sage

> Bad part is we have to use Miracle C to compile and build
http://www.daniweb.com/forums/thread193907.html
Like I said before, you need to slap your tutor about the head with an educational 2x4 until they learn that the compiler they recommend is a piece of CRAP.

Getting even trivial programs, which every other compiler would have no trouble with, is an exercise in frustration. Perhaps the name of the compiler derives from "OMG, it finally compiles, it's a fucking miracle". I used to think it was a case of "OMG, somebody actually paid me money for this PoS, it's a fucking miracle".

Who knows, maybe the "tutor" (I use the term advisedly) has got a kickback deal from the crapware author for recommending it. Either way, you're stuck with the suck.

Just forget the course and learn by yourself online. You'll get a hell of a lot further, and you'll enjoy learning it as well.

At least install something like http://www.codeblocks.org so that you can parallel compile your code with a real compiler. You'll then be able to see that what you tried with mira-crap was actually a real program which could be run successfully.

If you give your tutor a handful of examples of trivially correct programs which compile and run OK with CodeBlocks, but which elicit some kind of barf from miracrap, then they might start to listen.

jephthah commented: \/\/34D!!!1 +11
William Hemsworth commented: Lmao :D +11
Salem 5,265 Posting Sage

Except which one is "fastest on the current setup" is a moving goalpost with every patch / update / release / new compiler.

Plus if you're writing code which is in any way open source, then a whole raft of different compiler options will appear, each with their own "x is faster than y by z%" metrics.

If you don't already have any need for any C I/O, then you might avoid some code bloat by not dragging in libraries which you're not making a great deal of use of already, for what may be a marginal benefit.

File I/O is terribly slow anyway. You might want "cheetah", but all you've got is a choice between "snail" and "tortoise".

Here's an example. If your C++ I/O takes 1 hour, and your C I/O takes 50 minutes, there isn't any point in making the change. Your users are NOT going to come back from lunch 10 minutes earlier due to your efficiency.

Likewise, if it's around 10 minutes, then a few minutes either way won't get them back from the coffee break any time sooner.

If you're going to do it, one of the methods needs to break through a time barrier where your users would figure out they could go and do something more productive while your program was running.

An hour to a minute say needs a change of algorithm, not a change of I/O library.

siddhant3s commented: Well put. +11
tux4life commented: Very nice explanation :) +9
Sky Diploma commented: Lol, I want a cheetah too ;) +3
csurfer commented: Excellently put bro !!! +2
Salem 5,265 Posting Sage

> plz tell me how to convert a c code to matlab code
Why would you want to?

When you can already do this...
http://en.wikipedia.org/wiki/MATLAB#Interactions_with_other_languages

jephthah commented: Teh Goggle is mah frenn. +10