5,237 Posted Topics
Re: atoi is a C function expecting a char* Perhaps you need to implement a small conversion function which accepts a std::string instead. | |
Re: Now why are you casting the result of malloc? Could it be that you didn't include stdlib.h and thus the compiler considers malloc as returning an int rather than a pointer? This can be a well hidden and very obscure bug. > I need an array of approx. 2,00,000 elements.But … | |
Re: [ICODE]s/a lot/10% tops/[/ICODE] You won't find a great chef who got where they are just by reading cookery books. Plus I guarantee you that most of them will have set fire to something at least once! Likewise, if your own programs haven't locked up the machine, caused a reboot, or … | |
Re: Well how do you run a single test case at the moment? How do you run several test cases? Is it typing in a somewhat repetitive command? Post some examples. | |
Re: sed -e "s/DATEST\/08/25[B][COLOR="Red"]/[/COLOR][/B]2009:07:41:41/g" One or more of the / in your dates needs escaping. | |
Re: > how do you do a square root in MIPS? Same as anywhere else, assuming you lack a library to do it - research algorithms (you've got google, do some searches) - write code - test code | |
Re: [url]http://www.daniweb.com/forums/announcement118-2.html[/url] | |
Re: If you don't know how many strings, then use a std::vector<std::string> instead of named variables. Something like [code] vector<string> fields; string temp; while ( getline(isstream,temp,'|') { fields.push_back(temp); } [/code] Then check fields[0] for whatever. | |
Re: Which OS? Which webserver? Which firewall? You know, basic information about your setup. | |
Re: You've got [code] #include "somethingElse.h" #include "DoTestData.h" [/code] The last thing in somethingElse.h is the real cause of the problem, and it will be missing the ; in question. | |
Re: Your struct contains strings. These are not simple objects, they contain pointers to where the data is stored (elsewhere). Simple write() functions don't know this. [url]http://www.parashift.com/c++-faq-lite/serialization.html[/url] | |
Re: And so it begins..... If someone isn't smart enough to think of a project to do, offering them a project title doesn't do anybody any good. First they can't think of a title, so you suggest one. Then they can't figure out what that means, so they ask you to … | |
Re: > hi i want to compile .c file as .cpp file using makefile!!. You'd better read [URL="http://david.tribble.com/text/cdiffs.htm"]Incompatibilities Between ISO C and ISO C++[/URL] then. Especially if you're naively assuming that C++ is a syntactic and semantic superset of C (neither of which is actually true). | |
Re: > void processone(int delay); This is an int > processone(av[1]); This is a char* > void processone(char avinput) This is a char Making prototype AND definition a char* as well would go a LONG way. | |
Re: It goes up when you call testmap(), but does it go up again when you call testvec() ? Using a process monitor to determine how much memory is in use can be misleading. When you delete memory in your program, it typically goes back into a pool of memory owned … | |
Given the number of spammers (and other 1-posting drive-by's), how about designating certain threads as "fly paper". Fly paper threads have a high post count, and lots of buzz words, but are essentially useless to anyone who actually bothers to read them. If someone actually posts on them, they basically … | |
Re: Which program? Is this something given by your tutor with the instruction "adapt this CD inventory program for cars". Or was it "write an inventory program for cars", and you just happened to find one for CDs, and decided to see if you could con someone else into converting it … | |
Re: > My requirement is that I add a very small value of the order 10^-7 with a relatively big value, say 36.63 floats have about 6 decimal digits of precision, doubles about 15. 10^-7 is more than 6 digits away from [COLOR="Red"]3[/COLOR]6.63 so your really small number is effectively zero. … | |
Re: Don't keep opening and closing it INSIDE the for loop! | |
Re: [url]http://msdn.microsoft.com/en-us/library/ms687393%28VS.85%29.aspx[/url] [quote=msdn] Note This function is provided only for compatibility with 16-bit Windows. [B]Applications should use the CreateProcess function.[/B][/quote] WinExec() is a cheap "fire and forget" approach. What you should be using (namely CreateProcess) gives you a lot more control over what is happening, and provides you with the necessary … | |
Re: Post some more code, for example all the other declarations of variables used in this code. | |
Re: None at all springs to mind. At least none that matters. | |
Re: [url]http://www.daniweb.com/forums/announcement9-2.html[/url] There's a mine of information here [url]http://www.daniweb.com/forums/thread99132.html[/url] Try spending an hour or two trying to figure something out for yourself. Making a start, and getting stuck earns brownie points. Just dumping 1 liner of 0% effort doesn't. While I'm at it, [URL="http://www.catb.org/~esr/faqs/smart-questions.html#bespecific"]help me please[/URL] isn't a title for a … | |
Re: Open a file for writing (almost the same as you do for reading), and replace your printf() calls with fprintf() calls. | |
Re: > I've learned Java, C++, and most recently C ( Fall of last year). But have you actually learnt how to PROGRAM yet? Learning a new language a year makes you an experienced "hello world" programmer. The world is knee-deep in these kinds of programmers. The real trick comes when … | |
Re: > Accelerated C++: Practical Programming by Example Definitely a much better book than anything with "dummies" or "x days" or "guru" or any other kind of weasel words in the title. HOW to program is the real skill you should be working on, which will serve you well in decades … | |
Re: > for (int j=0; j<6; j++) You're scanning the whole array, not just the valid values (that would be < i ) > if (match==0) Nothing resets this back to 0 for checking the next time | |
Re: Like so [code] #include <stdio.h> #include <string.h> struct student { char studName; int studID; char sex; char email; int mathsScore; int englishScore; int scienceScore; }; void readData(struct student data[]); void printData(struct student data[]); int main(void) { struct student data[20]; readData(data); // pass parameter printData(data); return 0; } void readData(struct student … | |
Re: [url]http://www.daniweb.com/forums/thread208776.html[/url] [url]http://www.daniweb.com/forums/thread211532.html[/url] | |
Re: > Urgent Help! This is neither [URL="http://www.catb.org/~esr/faqs/smart-questions.html#bespecific"]descriptive [/URL]nor [URL="http://www.catb.org/~esr/faqs/smart-questions.html#urgent"]accurate[/URL] | |
Re: mov ah,1h ; input number int 21h mov dl,0ah The result is returned in al [url]http://www.ctyme.com/intr/rb-2552.htm[/url] | |
Re: What you posted isn't C. Objective C is a very different animal, which not so many people are familiar with. | |
Re: There's no guaranteed way, if that's what you want. | |
Re: > vararray[v+1]==NULL Well if vararray is an array of char, then testing the nul character (as opposed to the NULL pointer) is what you should be doing. As in [ICODE]vararray[v+1]=='\0'[/ICODE] | |
Re: So why the double open? [code] [COLOR="Red"]f = fopen(p, "w");[/COLOR] fprintf(f, ""); fclose(f); [COLOR="Red"]f = fopen(p, "a");[/COLOR] [/code] | |
Re: Better yet, tell US what you found out, how you solved it and then mark it closed. Give something back. | |
Re: > i have till wednesday(26/08) to finish it. Shouldn't that have read "YOU have until Tuesday 25/08 to finish it" ;) | |
Re: > cout << "a1 is " << a1 << endl; The compiler (since it knows the value is const) is allowed to generate [ICODE]cout << "a1 is " << 40 << endl;[/ICODE] If you smash away the const-correctness of your program, then don't complain when the results bite you. | |
Re: Double what you had. The more capable it is, the longer it will last and the quieter it will be while it is running. | |
Re: > a[l1+i] = 0; You didn't initialise i That means boom today (or boom tomorrow if you're unfortunate) | |
Re: EOF != feof() The former is a constant, and the other is a function call. Also, this would be better [ICODE]while ((fscanf (input, "%s %d %d", studName, &bioScore, &cheScore) ) == 3) [/ICODE] That is, a positive assertion of success, not a negative assertion of only one possible failure. I'm … | |
Re: Go for RAM. The extra processor speed (only about 10%) won't be worth squat if the system starts swapping excessively. But make sure the architecture would actually be able to USE 4GB of RAM. Intel 32-bit PC's typically can't use much past 3GB even if you put the RAM in … | |
Re: insert() returns a value, which you're ignoring. | |
Re: > but I don't know if it's a good idea to let them know I'm looking for another job Are you that set on finding another job? I mean, if your current employer offered you more money, a better desk, more responsibility, different project (or whatever), would you take it? … | |
Re: Is this a new development (a fault), or something it's always done (a feature)? Does it do this all by itself (isolated from network/PC etc), or only when you start windows (for example) | |
Re: You're assuming a) the network has zero latency, by calling recv() directly after send() b) that recv() will just stick around until a \r\n arrives - it won't. c) that recv() will add a \0 to the end of the buffer to make it a proper C string - it … | |
Re: Congrats AD :) > Now this is a marriage to be proud of Married 83 years, they have 186 descendants. A birthday to remember every other day - that's gotta be hard work. "What are you doing? Buying a present. Who for? Dunno, bound to be someone's either today or … |
The End.