5,237 Posted Topics
Re: [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044842972&id=1043284392[/url] Same principle for C You separate the implementation (in a .c file) from the interface (in a .h). Everything else includes just the interface, and the implementation is in just one place. Also, stop calling your C programs with a .cpp extension. That will just lead you astray. | |
Re: > Why use a do loop ? It's one of the standard techniques to ensure that a multi-line macro such as this always appears as a single statement. See [url]http://www.c-faq.com/cpp/multistmt.html[/url] @OP [INLINECODE]>#define allocate_cube(type, var, x, y, z) \ > do { \ > (var) = malloc(sizeof(type **) * (x)); \[/INLINECODE] … | |
Re: You need to compile both files, as in [ICODE]cc -o prog testtrp.c treap.c[/ICODE] Of course, exact details for your IDE will vary, but that's the essence of what you need to do. | |
Re: > What should I do? Find another forum. Not that I'm suggesting you leave or anything, but you need to understand that no matter how great you think DW is, it's not the only show in town. A forum with 10K+ dedicated VB programmers would be a better place to … | |
Re: > Every book I've read stresses the value of writing code with maintenance in mind, > but hey this is the real world, right and am I just being naive? Most real world software, especially commercial software is much better written. I think the problem you have is that the … | |
Re: Well there is [ICODE]std::sort[/ICODE], which will work on a [ICODE]std::vector[/ICODE] of integers. If you know what you're doing, it would take about 10 minutes to write - is that quick enough? Or how about using your command line sort program [ICODE]sort -k1n -o result.txt input.txt[/ICODE] | |
Re: g++ -S prog.cpp Now go look at prog.s to see the assembler. | |
Re: Start with > Enter total acres: 12000 Which ends with "You entered 12000 for the acres" If you can't get the input right, the rest of the calculation just won't work. Break the problem down into small steps. | |
Re: The linker takes all your objects and libraries, and produces a relocatable program which can be executed by the OS program loader. The locator goes one step further and fixes the image at a specific address in memory. You would use a locator if you were say producing bootstrap code … | |
Re: 1 down, 3 to go [code] void displayUserHeading ( void ) { // something here } int main ( ) { displayUserHeading(); return 0; } [/code] | |
Re: > But i also have a bigger problem which is in the research itself. I only found like 2 or 3 articles. Well if it was real research, there should be ZERO papers. Not slapping together some half-assed result of a few google searches. > I haven't made any contributions … | |
Re: Well in main, you need to do this [CODE]int *result = readArray(size); printArray(result,size); free( result );[/CODE] | |
Re: > but as I am beginner in C/C++ Unfortunately, reading [URL="http://accu.org/index.php/book_reviews?url=view.xqy?review=c002173&term=c%2b%2b+reference"]schildt [/URL]books won't clarify the issue either. Pick a language and stick to it. Despite their recent common ancestry, and superficial similarity, using both of them well requires a C++ hat AND a C hat. C/C++ is just brain-damage. > … | |
Re: Other applications seem to manage it when they want user attention. So I'm going with "yes" as being the answer to your question, it is possible to do that. | |
Re: Cut and paste works, as a bootstrap to get you going. If you have [ICODE][COLOR="Red"]int array[2][3][4][/COLOR];[/ICODE] and you want to pass that to a function, then you simply do [CODE] void myFunc ( [COLOR="Red"]int array[2][3][4][/COLOR] ); // prototype void myFunc ( int array[2][3][4] ) { // definition array[0][0][0] = 0; … | |
Re: [url]http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html[/url] | |
Re: [url]http://clusty.com/search?query=mysql+c%2B%2B&sourceid=Mozilla-search[/url] | |
Re: I'm wondering something too. Like how are we supposed to guess which OS / Compiler / UI Toolkit you're using from just a few UI buzzwords scattered through the post and 2 lines of code. | |
Re: Perhaps begin with a simple program which reacts to single key presses. Then write another program to implement the basic queue data type. Then come back to us. | |
Re: And you'd still get posts in it from the Turbo C luddites as well. Most of the time, they don't have a clue what their question is. Is it an OS question, a C++ question, a compiler question or an API question?. They just scan the forum titles (ignoring the … | |
[url]http://news.bbc.co.uk/2/hi/technology/7451268.stm[/url] | |
Re: Or we simply don't care enough. Basically, saying [URL="http://www.catb.org/~esr/faqs/smart-questions.html#urgent"]urgent[/URL], dumping your assignment and not putting forward any [URL="http://www.daniweb.com/forums/announcement125-2.html"]demonstration [/URL]of what you've tried so far pretty much guarantees most people will go and find more worthy people to help first. I'm only posting this because it's my last post of the … | |
Re: So what's YOUR question? Mine is "Why haven't you read the intro posts on how to use code tags?" | |
Re: Yes, we all can solve it. The question is, are you going to attempt it yourself first? That's what the intro thread tells you. | |
Re: Why did you ignore ALL the places which tell you about code tags? | |
Re: SS means stack segment. EBP typically moves around with ESP (BP=Base Pointer, SP=Stack Pointer). The BP is typically used to establish a fixed point of reference for a stack frame. BP + offset would typically be parameters, BP - offset would be local variables and temporary storage. | |
Re: [url]http://curl.haxx.se/libcurl/[/url] Would take care of a lot of the lower level details of HTTP. | |
Re: The range as it stands will run from 0 to 9 So add 1 to it, to get 1 to 10 | |
Re: It's a confusing time jwenting ;) On the one hand, they're looking for a nice easy project they can hand in for maximum marks with minimal effort. On the other, they have to maintain the illusion that the difficulty level is within the scope of their meagre skills, and it … | |
| |
Re: If you have a.h b.h c.h And you include a.h, what exactly are you hoping to achieve with the other header(s) ? | |
Re: Do you want a foot massage while you're waiting? Enter the [URL="http://www.daniweb.com/forums/announcement125-2.html"]relaxatron here![/URL] | |
Re: [code] struct uservar { struct uservar *next; char *userVarName; int userVarValue; } [/code] When you want to create a new one, allocate one of the above, complete the name (and value), and append to a list. When you want to look up the user named variable, search the list. etc … | |
Re: [url]http://www.daniweb.com/forums/thread128202.html[/url] Your previous thread. | |
Re: Very good, now read all the intro threads and figure out what all that "how to post code" is all about. | |
Re: > The original code takes in a url as an argument. The first argument will be argv[1]. argv[0] is traditionally the program name. Also, rather than assuming that argv strings can be modified, just make a copy of it in a variable you KNOW you can modify. It's not like … | |
Re: [icode]email client <---> [COLOR="Red"]filter [/COLOR]<---> SMPT server[/icode] Rather than connecting directly to mail.myisp.com, you connect to 127.0.0.1 and the filter then connects to mail.myisp.com Your filter looks like an SMTP server to your normal email client, and looks like an email client to your ISP's mail server. The filter sees … | |
Re: 1. You didn't mention which tutorial you read, so we don't know whether it was any good or just some 10+ year old hack for an older operating system. 2. You didn't say which OS/Compiler you're using now. 3. You didn't show us the code you tried. > if you … | |
Re: But "Fred Flintstone" reads as "Fred Flintstone" to anyone smart enough to use a hex editor. Sure, if you write enough other binary data along with it, most simple text editors will barf on the file, but no hex editor will. You could try encrypting the file, but by necessity, … | |
Re: Why not simplify, and just write the whole file? Unless you're incrementally adding (always) to a file which is many megabytes in size, this isn't going to take much longer than any other approach. Or how about a boolean, which records whether a header exists in the file (or not). … | |
Re: It's Sleep(), note the capital 'S', and it's in windows.h. It counts in milliseconds. | |
Re: I know that you didn't read - [url]http://www.daniweb.com/forums/forum8.html[/url] or - [url]http://www.daniweb.com/forums/announcement8-3.html[/url] or - the watermark at the back at the edit window. Had you done so, your post would have been readable, and not riddled with smilies, formerly known as scope operators. | |
Re: 1. 13! overflows an int. So unless you're keeping to really small values, expect trouble here. 2. (numerator/denominator) If both of these are ints, the result is integer division (truncation towards zero, result is an integer). Cast one of them to double before dividing, not afterwards. | |
Re: [url]http://clusty.com/search?query=how+to+create+a+windows+service&sourceid=Mozilla-search[/url] | |
Re: Post your code, not the rubbish it prints. | |
Re: [QUOTE=joshmo]> why dont you do something like this > if (x == "EASY" || "easy" ) [/QUOTE] You've written (with red bits for clarity) [ICODE]if ( [COLOR="Red"]([/COLOR] x == "EASY" [COLOR="Red"])[/COLOR] || [COLOR="Red"]([/COLOR] "easy" [COLOR="Red"]!= NULL )[/COLOR] )[/ICODE] In essence, it's always true, because the right hand side is always … | |
Re: You only need the [ICODE]extern "C"[/ICODE] if you're mixing C and C++. If it's all C++, then [ICODE]extern [/ICODE]should be fine. Post actual code and error messages if you're still stuck. | |
Re: Well the implication from the text is that argv[1] is the "document???.cry" file. How about posting the code which verifies that an argument exists and then goes on to open the file and read it's contents (much like you do with cin at the moment). |
The End.