506 Posted Topics
Re: preprocessor directives/macros are processed at the time of compilation. Arguments relevant to preprocessor (e.g. -DXXX=value) are passed to compiler and used by compiler. Any argument passed on command line is called command line arguments. :). So these are the CLI args to compiler. After compilation (and linking) the executable of … | |
Re: Consider following the coding practice: When you compare a const with a non-const for equality put const on LHS instead of RHS. E.g. [code=c]//instead of this: if ( start == 0 ) //do this: if ( 0 == start )[/code] | |
Re: Check out [URL="http://www.daniweb.com/forums/showthread.php?t=72703"]this thread[/URL], it also has some links to more info... | |
Re: Problem is you're copying old to new, whereas what you want to do is new to old. Also using wrong formatting in printf(). See the comments inside the code: [code=c] #include <stdio.h> #include <stdlib.h> #include <string.h> //to avoid hard coding. #define MY_MSG_LEN 100 int main(void) { char oldMsg[MY_MSG_LEN], newMsg[MY_MSG_LEN]; int … | |
Re: Post the errors you got.. (copy paste, don't use your own words to describe) | |
Re: No way I can understand so much of code without code tags.. | |
Re: Must be something to do with the way you're using them.. parameters etc.. see which object file or .so or .a file contains teh required symbols and add that on link cmd.. | |
Re: [quote=praneeth_gunda;398354]Am Giving u The Code Mr.Naure[/quote] Sorry couldn't help comment off topic.. It's Ms. Naure not Mr. :D See the avatar? | |
Re: Depends on what your friend means.. does he mean use C++ language features to solve the problem that is solved using C.. Or does he mean just make this code compile using a C++ compiler.. ? | |
Re: See [URL="http://www.daniweb.com/forums/showthread.php?t=73182&highlight=Runtime"]this thread[/URL].. it should answer all your questions and give you enough examples.. | |
Re: [quote=endsamsara;397902]Hi, How do i create a class called Text that creates an object from a string and that deletes the first word of the text have no idea I was starting like [code] public class Text{ public static void main(String[] args) { String str = "this is a little text … | |
Re: You've posted it to wrong forum.. [URL="http://www.daniweb.com/forums/forum72.html"]Post it here[/URL].. | |
Re: >> Can one get the system function to let the called program write its output to a >> variable instead of writting it in the command window? Yes. But AFAIK it would be useless because that variable would be part of the shell (assuming you're on Unix) that executes teh … | |
Re: >> Is a base and derived class overkill for a sorting function? Yes (because for all practical purpose you would want your sort function to have bare minimum overhead, e.g. virtual call in this case). But not if you're trying to learn templates, inheritance and function objects >> How cand … | |
Re: Or of course you can pass it by C++ reference like: void foo( char *& ptr) { ptr = new char[255]; } int mian() { char *ptr = 0; foo( ptr ); <snip> return 0; } | |
Re: Some more info like OS, Java version, kind of application would help. I don't really know anything specific in Tomcat itself though. :). You can do things like nice in Unix. | |
| |
Re: [URL="http://www.daniweb.com/forums/thread70096.html"]This thread[/URL] is meant for such questions. | |
Re: A pointer pointing to base class can be converted to a pointer pointing to derived class (down-casting) if the original pointer is actually pointing to a derived class type. To enforce this is the work of dynamic_cast operator. Consider following example. [code=cpp]#include <iostream> using namespace std; class base { public: … | |
Re: AFAIK: A web-server usually hosts only front-end jsps/htmls. It will have very little or no business logic. An Application server on the other hand would host a lot more of business logic. | |
Re: Interesting.. 1. I didn't know that -lXYZ could be interpreted by linker as libXYZ.[COLOR=red][B]a[/B][/COLOR] as well. (thought it's always seen as libXYZ.[COLOR=red][B]so[/B][/COLOR]). I checked gcc manuals (gcc 4.2.0) and seems fine. 2. Only reasons I can think of why this could be happening is: A) There are object and library … | |
Re: 1. Inside copyStack() this line.. [inlinecode]current = otherStack.stackTop;[/inlinecode] ..would ensure a crash as it would make current point to NULL. 2. Usually it's better to re-use the code. So in this case you can implement the copy like this: [code=c] void linkedStack::copyStack(linkedStack& otherStack) { node* currNode = stackTop ; int* … | |
Re: Read-up the basics of arrays, function, function parameters.. then write a program and ask for help.. | |
Re: [quote=quintoncoert;394188]Thirdly. Can anyone suggest some good books on MFC?[/quote] If you donno anything this is usually a good starting point. :) [URL="http://www.amazon.com/Visual-C-Dummies-Michael-Hyman/dp/0764503723"]Visual C++ 6 for Dummies[/URL] Although I personally prefer "the internet" to learn basics and books for more in-depth stuff.. | |
Re: [B]Line 15: [/B]Reading from cin, read from "file". [B] Line 18: [/B]This would always set charsPerLine to 0. (12/100) would evaluate to 0. Make it (12.0/100.0) [B] Line 23-24: [/B]Not clear what are you trying to do. Remember getline() remove teh '\n' char. So you won't find that in captionText. … | |
Re: [quote=happygeek;394707]Sounds awfully like someone expecting the DaniWeb membership to do their homework assignment for them, without any effort of their own, to me...[/quote] I++ | |
Re: 1. The reason why you're getting some junk for last line is because you have given 6 %d(s) inside the format string and supplied only 5 values. 2. Execute the following code and you should see some difference. May be that should point you in right direction. Here are the … | |
Re: >> for some reasons i hav #included B.h in A.h hence #include A.h in B.h is giving error. This should never be done. In any case include guard as Naure described should solve the problem. But I suggest you relook at your dependencies and see how to avoid one of … | |
Re: Usually you are supposed to have 2 files per class. Header file: ClassName.h, which declares the class interface. Source file: ClassName.cxx/cpp/.. which defines the class. I.e. has implementation for the class's interface. Assuming you have A.h and A.cpp, to use A's variables in another class B, you'll have to #include … | |
Re: Use MS Visual C++ (get Visual Studio).. you can find lotsa online tutorials for that.. | |
Re: Am on level 6.. :) took about 10 minutes to get there after the KlueLess experience.. | |
Re: Looks like local_jlist is a function local variable (inpublic Prod_applet()).. and not in the scope where you're using it (line 226).. make it a member variable.. it should work.. | |
Re: Write your own tokenizer.. should be easy enough.. | |
Re: sorting the list should help. | |
Re: A dll is not a process.. :) May be the following will help: - Once you've written your C/C++ code, you will compile it and then link it. Once you do this you will have an executable file (.exe on windows) - Your code usually be using some or the … | |
Re: [quote=reedla;392326]Am I close at all??[/quote] May be about 10% of your work is done. | |
Re: In simplest terms: Compiler looks at a 2D array as a 1D array that has a 1D array as elements. | |
Re: [quote=Salem;391508]Even the most optimistic precision (not accuracy) figures for clock() are at least 1M times slower than the clock frequency of most modern desktop machines.[/quote]Not that it stops you from using clock(). All you gotta do is just put the code in a loop and run it a few 100/1000 … | |
Re: I just did a Ctrl+F in this thread for following 3 functions: cannot find symbol method setItemNumber(java.lang.String) cannot find symbol method setProductName(java.lang.String) cannot find symbol method setNumOfUnitsInStock(int) I didn't see their definition.. That should be the problem. | |
Re: 1. Write some comments in the code. 2. Nice of you to use code tags, did you know that you can also add the language name to it for syntax highlighting. 3. Problem might be that next is not initialized to NULL. So on line 110 after first iteration current … | |
Re: I don't know of any C/C++ function that waits for user input for a finite/specified time. Which means you'll have to use multi-threading for sure. See [URL="http://www.daniweb.com/forums/showthread.php?t=71946&highlight=thread+input"]this thread[/URL] if it helps. | |
Re: [quote=aasi007onfire;391062]if they r the same then why 2 names r being used..[/quote] Surprised that no one mentioned that they are NOT the same and that's the reason 2 different names are used. As Aia said only rule (according to standards) is [COLOR=Green]sizeof( short ) ≤ sizeof( int ) ≤ sizeof( … | |
Re: First I assume your question is how to find out the performance/time of your function. In this case I really donno how you can use Sleep ?! As I use timing quite frequently I have the following code (similar to Vijyan's) I use to make it easy to use. [code=cplusplus] … | |
Re: >> size_t n = vint.size(); >> int arr[n]; This is not supposed to work ! [quote=JRM;389991] I tried to do direct assignment: arr=vint // why won't this work? essentially they're both arrays- or so i thought.[/quote] I donno what you mean by won't work. But this thing in particular is … | |
Re: If you don't wanna be platform dependent you can still do this by forking a thread for system(). Should be simple enough as well. [code=c]pid = fork() ; if( 0 == pid ) system("...") ; //your normal code here.. [/code] | |
Re: There shouldn't be a "major" difference due to compilers, it's more to do with the platform (OS+H/W) then compiler. Using same compiler you can use different optimization levels, this should make a visible difference in performance. | |
Re: In Visual Studio 6, by default it creates 2 configurations "Win32 - Debug" and "Win32 - Release". The way to go to debug build is somewhere you have an option (think in Project menu) to "Set active configuration". There ensure that you've selected "Win32 - Debug". One way to know … | |
Re: [quote=bala24;390761]Hi guys and Gals, Have some trouble digesting some facts about Casting in C++. 1). Why can't we use a static_cast for safe downcasting on a polymorphic class? 2).Consider this snippet.. [code=cplusplus] class A {}; class B { public: B (A a) {} }; A a; B b=a; [/code] [COLOR=green]How … | |
Re: 1. Don't use goto, language provides so many other better/safer/understandable ways. 2. Seems like PORTAbits.RAXX is an int/short instead of a boolean. I would suggest: A) Trace out their values. B) See how to check such flags. I remember there was some thread where I described how bitwise operations are … |
The End.