5,237 Posted Topics
Re: > inventory[numItems] = "sword"; > inventory[numItems] = "armor"; > inventory[numItems] = "shield"; All of these overwrite one another. Try [INLINECODE] inventory[0] = "sword"; inventory[1] = "armor"; inventory[2] = "shield";[/INLINECODE] > cout<<"1. sword\n"; > cout<<"2. armor\n"; Rather than relisting the text string, use a loop and output strings direct from the … | |
Re: Historically, - C++ was derived from C. - In C, everything was an int unless specified otherwise (there was no void), so it was natural for main to return int. - C programs were originally developed for command line use, and using a command line interpreter which was far more … | |
Re: A dose of [URL="http://www.daniweb.com/forums/announcement8-3.html"]this[/URL] and [URL="http://www.catb.org/~esr/faqs/smart-questions.html#bespecific"]this[/URL] wouldn't go amiss either. | |
Re: Mixing input methods is always a disaster waiting to happen, especially when you mix those which attempt to parse the input with those which just read the input. The different ways in which white-space and newlines get treated will catch you out. Read a whole line into a string (preferably … | |
Re: > Any one familiar with this error? No. [url]http://www.catb.org/~esr/faqs/smart-questions.html#prune[/url] How about posting something useful like - which OS and compiler - your example program which shows that error. Talk about minimal information, you may as well have just posted a "?" | |
Re: It also seems to contain Visual C++ project files as well, but not a dev-c++ ".dev" project file :confused: | |
Re: What else you need to do includes reading some sticky threads before posting. [url]http://www.daniweb.com/forums/thread78223.html[/url] | |
Re: @tahnan First write some code which say displays the current board, as outlined in your previous posts. | |
Re: Would you know how to find the max value in a 1-D array, say {3,41,5,6,7} ? It's exactly the same, only you change the way you index the data, that's all. | |
Re: In which case I would say you're not posting the code you're compiling. The only way to get those warnings with VC++ is to do this [INLINECODE]char Name[13]; strcpy ( [COLOR="Red"][B]&[/B][/COLOR]Name, "George Brown");[/INLINECODE] As written, both snippets are fine. | |
Re: How about this little rider in the manual page? [quote=msdn] Because some devices kern characters, the sum of the extents of the characters in a string does not always equal to the extent of the string.[/quote] > I'm looking for a more accurate and precise way to set the > … | |
Re: > how to create a 2d dynamic array of strings called book? Forget about making it dynamic for the moment, and go with [INLINECODE]char books[10][100]; // 10 books, up to 100 chars of info on each one [/INLINECODE] Then you can do things like [CODE]strcpy( &books[0][0], "bill" ); strcpy( &books[0][20], … | |
Re: Post a complete program which we can all compile, which produces the errors which you see. There could be any number of reasons, anywhere in the code which could cause this effect. As soon as you trash memory, then anything can happen, including working for a while, producing garbage, then … | |
Re: Thank you for not reading the "how to post code" thread at the top of the forum, and generally ignoring the watermark at the back of the edit window :icon_rolleyes: | |
Re: Who's version of GetTickCount() are you talking about, so we can establish a frame of reference. | |
Re: > Is there a standard function to know cpu usage, how much memory left, etc No there isn't, which is why you need to state your OS and compiler if you want to make progress on this. | |
Re: > It's assigned a memory location of 0x6e615c31 Which looks a lot like a string fragment of "na\1" The \ is telling, does it look like part of a filename perhaps? I'm betting that you're copying a string into some other allocated memory, and this is where you observe the … | |
Re: > how the computer know if that is an ASCII character or integer value? It doesn't. That's for you (as a programmer) to decide, based on how you try and use that data. | |
Re: Even with a single compiler, whether you choose to build the debug or release version, or whether you choose static or dynamic linking with the run-time library can have huge impact on the (apparent) size of the executable. What's your point? This isn't going to turn into another "x is … | |
Re: > I declared a temporary character pointer (tmp) in main and used it directly in strcpy function > But when I tried to do the same in a function, I started getting run time error. This is your first lesson in getting to grips with the adage "working is not … | |
Re: Did you get the "Ralph Brown Interrupt List" I referred you to in another post? | |
Re: Thank you for reading the [URL="http://www.daniweb.com/forums/announcement8-3.html"]READ BEFORE POSTING CODE[/URL] thread at the top of the forum. We look forward to your custom in future lifetimes. Signed The Magrathean defence committee. | |
Re: [url]http://cboard.cprogramming.com/showthread.php?t=91808[/url] Try to stick to one forum at a time, and only move on when they stop delivering what you want. Many of the more experienced helpers frequent several forums, so this kind of broadcast at best pisses off the very people most likely to give you good advice. | |
Re: Yes, visit the expat home page and study the examples / tutorials. The essence of expat is that you configure it with a number of callback functions to be called when expat recognises a particular part of XML (say an element). Start with something basic, say something to print out … | |
Re: [url]http://forums.devshed.com/c-programming-42/convert-markdown-to-markup-460021.html[/url] | |
Re: Which compiler are you using. I'm guessing that it's gcc with cygwin, since that's the library you mention. What command line did you try? It needs to be something like [INLINECODE]gcc prog.c [COLOR="Red"]-lcurl[/COLOR][/INLINECODE] The part at the end is what tells the compiler that you're interested in using curl functionality. … | |
Re: Or just put that path into the project settings. Something like compiler->pre-processor->additional search paths. Copying the header files to the vc++ standard include directory is a bad idea. If there are any conflicts now (or in the future), you're screwed. | |
I find this morning a complete change to the order of rep Eg. ~s.o.s~ boosted with [URL="http://www.daniweb.com/forums/post397686.html#post397686"]how to send emails...[/URL] Jul 10th, 2007 5:04 am [URL="http://www.daniweb.com/forums/member40914.html"]Rashakil Fol[/URL] KHAAAAAN! [URL="http://www.daniweb.com/forums/post397979.html#post397979"]Chess Tournament[/URL] Jul 10th, 2007 4:59 am [URL="http://www.daniweb.com/forums/member40914.html"]Rashakil Fol[/URL] KHAAAAAN! [URL="http://www.daniweb.com/forums/post398007.html#post398007"]Chess Tournament[/URL] Jul 10th, 2007 4:58 am [URL="http://www.daniweb.com/forums/member40914.html"]Rashakil Fol[/URL] KHAAAAAN! [URL="http://www.daniweb.com/forums/post398011.html#post398011"]Activate Membership[/URL] … | |
Re: You'd think some people would know by now not spoon-feed complete answers without any demonstration of effort from the OP [URL]http://www.daniweb.com/forums/announcement118-2.html[/URL] > [COLOR=green]void main( void ) This is simply wrong. main returns an int - no ifs buts or maybes. > [/COLOR][COLOR=green]gets ( a ); This is utterly dangerous. Use … | |
Re: > So I tried [B]TURBO C++ 3.0[/B]. And it worked perfectly Basically, you have a choice. - Stick with a 16 bit compiler, and low resolution graphics library from antiquity. - Upgrade to a more modern 32 bit compiler, and learn a new graphical API (say OpenGL). > it does … | |
Re: The function pointer tutorial [url]http://www.newty.de/fpt/index.html[/url] | |
Re: Concurrent access to data shared between programs is specific to your implementation (OS, compiler, etc). Unless your shared data exists in a file which one program writes to, then another program reads. That's pretty portable. | |
Re: Yes, you are right and your quiz master is wrong. Where is this quiz, is it online somewhere? | |
Re: Which micro controller? Perhaps [url]http://www.avrfreaks.net/[/url] [url]http://www.microchip.com/[/url] | |
Re: If you're trying to do [code] system( "cd \\the\\yellow\\brick\\road" ); ifstream fin( "lion.txt" ); [/code] then you're going about it all wrong. Any changes you make inside system() are localised to the sub-process which is created (and then lost almost immediately). The current directory seen by ifstream isn't at the … | |
Re: You'd get a lot more help if you posted your code. Don't forget the code tags - see the watermark at the back of the edit window, and the "posting code" readme threads at the top of the forum. | |
Re: IIRC, it's [code] #include <winsock2.h> #include <windows.h> [/code] | |
Re: [code] [COLOR=green]#define REPORT_HEADINGS_1 printf("\n Employee " \ "Pay Reg Hrs " \ "Gross Fed SSI Net\n");[/COLOR][/code] The \ at the end of each line folds long lines for the benefit of the pre-processor. The compiler will then join "string " "literals" into "string literals" for you. ![]() | |
Re: > Such as system("title x"); or system("color 4f"); [url]http://msdn2.microsoft.com/en-us/library/ms682087.aspx[/url] | |
Re: > in below giving statements which one is efficient. They're the same. Most modern compilers will generate the same code for both constructs. Even if the generated code is different (for some rare compiler), it's only going to be one instruction more. Telling which form will generate the extra instruction … | |
Re: [url]http://www.daniweb.com/forums/announcement8-3.html[/url] > for(int i =0; [COLOR=Red]i <=0[/COLOR]; i++) How many times around the loop is this going to be true? - zero - one - more than one | |
Re: The first problem with the rep system is that it is all-or-nothing "agree or disagree". So for people with lots of rep, they can only "strongly agree" or "strongly disagree". For anyone familiar with devshed's approach (which I find much better in this respect), you can choose how many points … | |
Re: [inlinecode]int *array = new int[b];[/inlinecode] Or if you can, use a [inlinecode]std::vector[/inlinecode] | |
Re: Post your code. If that isn't practical, create a small test case which shows the same symptoms, and post that. Post the actual command lines you used to compile your code, and actual error message(s) you get in response. | |
Re: > return0 Maybe it's the lack of a space and a ; Like [INLINECODE] return 0;[/INLINECODE] | |
Re: Maybe read a book, or an online tutorial. Any half decent reference should tell you this basic information. | |
Re: 25 posts, and you still can't get to grips with this [url]http://www.daniweb.com/forums/announcement8-3.html[/url] | |
Re: It's only properly available in C99 [quote=gcc manual] [B]5.19 Compound Literals[/B] ISO C99 supports compound literals. A compound literal looks like a cast containing an initializer. Its value is an object of the type specified in the cast, containing the elements specified in the initializer; it is an lvalue. As … | |
| |
Re: Why do you care? Today's desktop PCs use virtual memory for allocating stack space, and the default initial size is usually around the 1MB mark. In windows for example, the stack is allocated on demand in 4K blocks at a time. Saving a few bytes here and there isn't going … |
The End.