5,237 Posted Topics
Re: > Whats better? C++ or VB? What's better to a carpenter - a hammer or a screwdriver? Like the proverb goes, "If the only tool in the toolbox is a hammer, pretty soon all the problems look like nails". | |
Re: What do you mean "exists"? It exists by you using it. Like [INLINECODE]printf( "The version is %s", GPSINIT );[/INLINECODE] or [INLINECODE]const char *ver = GPSINIT;[/INLINECODE] or [INLINECODE]char temp[100]; strcpy( temp, GPSINIT );[/INLINECODE] All of them in their own way get the address of the start of that string. Now as … | |
Re: Split from a dead thread - please don't bump dead threads. | |
Re: It outputs a list of all the blocks to the debug console, like {42} block .... You take the 42 and assign it to something like _dbgBreakAlloc (read the manual to find out what it is actually called), then the allocator will stop when that block is allocated. You then … | |
Re: I dunno, depends on what you mean by "not working". Does it mean "file not found" Does it mean "the file seems to be corrupt". Also, how did you 'include' it? Did you do something like #include "file.lib" // this is wrong Or something else? Where did you get the … | |
Re: You're going to have to do better than just attaching your homework. [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] Also, tell your tutor that void main is wrong. [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044841143&id=1043284376[/url] | |
Re: Cryptography is based on algorithms (and some very heavy mathematical analysis), not choices of implementation language. [url]http://en.wikipedia.org/wiki/Cryptography[/url] > I mean that can be acctualised using a C program. Since C is a Turing complete language, if you have an algorithm, then you can express that algorithm in C. > I … | |
Re: > int ht, wd; You use these in your array subscript calculation, but you never set them. They should be passed as a parameter to the function anyway. > stringPtr[position] = malloc(strlen(setstring) * sizeof(char)); When allocating a string, you need to count the \0 as well, otherwise it ends up … | |
Re: > #include <stdio.h> > using namespace std; So which is it - C or C++ ? Pick a language and stick with it. If you try and walk down the middle of the road with C/C++, you'll just end up being road kill. > struct ALLE_PATIENTENDATA patient[aantal_patienten]; Variable length array … | |
Re: From your other [URL="http://www.daniweb.com/techtalkforums/thread68395.html"]post[/URL] > Assert failed at line 250 of c:\code\allegro\include\allegro\inline/draw.inl Open draw.inl in your editor. Goto line 250. Read the line which will be something like say ASSERT(x >= 0); The code expects that expression to be true. In your program, that expression was false. Now ask yourself … | |
Re: First step is to download a compiler, which matches your operating system [url]http://www.daniweb.com/techtalkforums/thread50370.html[/url] | |
Re: > somehow to stop that loop ONLY when I press a key You need to say which OS and compiler you're using. There is no portable answer to this question, so we need specifics. | |
Re: > Is there any way to detect this without using winAPI or any other standard APIs??? No there isn't. Standard C doesn't know about keyboards, mice, screens or other advanced stuff like that. It has an input stream, which is usually buffered, so there goes the "immediate" requirement. It also … | |
Re: > myImage = ( "G:\\My Images\\box.bmp", NULL); Were you expecting (or hoping) to call a function at this point? Because all you've written here is myImage = NULL; | |
Re: [url]http://c-faq.com/ansi/undef.html[/url] To answer the first question with the second question, an example of implementation defined behaviour is >> on negative numbers. | |
Re: [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_the_playsound_function.asp"]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_the_playsound_function.asp[/URL] | |
Re: > cin >> iNumGrade; So perhaps [INLINECODE]cin >> iNumGrade >> iAnotherGrade; int iTotal = iNumGrade + iAnotherGrade;[/INLINECODE] Or do you want to specifically extract the '+' as well? | |
Re: Also, which compiler are you talking about? Also, is this a new problem (like it used to work), or have you just installed it. | |
Re: I'd say that you're over interpreting the data. Crash dumps have very little symbol information. It's probably just 6 words from the stack pointer. Whether that matches any parameters (or local variables) needs more research. The only obvious bit of information is the fault address is memcpy + 0xe8 | |
![]() | Re: > usingnamespace std; It seems that whatever you used to format the code, it's come through on the board as a big mess. If you can still edit your post, I would suggest you do so, and use "post preview" to make sure we're going to see what you're seeing … |
Re: It would be better to use fgets and sscanf, like [code] char buff[BUFSIZ]; while ( fgets( buff, sizeof buff, fpIn ) != NULL ) { if ( sscanf( buff, "%[^,], %d, %[^,], %d", name, &year, cap, &popRank ) == 4 ) { // success, do something } else { // … | |
Re: > Since '\n' is always the last character in the buffer there is no point using those functions No it isn't. If the line is longer than the buffer, then there will be no \n in there at all, so just trashing the character before the \0 is wrong. | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] | |
Re: Couldn't you just have described the method rather than spoon-feeding the OP an answer. I'm sure that answer is just going to get handed in without any more thought. What are they going to do with their next assignment, just post it here and hope for the same thing. | |
Re: Guess you missed this when you rushed into the forum. [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] | |
Re: Or save yourself a lot of grief in the long term by downloading a compiler which matches your OS. Say dev-c++, and if you want graphics then grab the libsdl 'devpak' addition. Then visit [url]www.libsdl.org[/url] for examples. | |
Re: So what have you tried - or even read about which might suggest what you've tried. I can't even guess as to which language you want this in as yet. | |
Re: > for(i=0;i<=100;i++) There are many MANY examples of you accessing outside the bounds of your arrays. more - db[9][7][0]=6686; and more - db_init() | |
Re: [INLINECODE]card deck[52];[/INLINECODE] Where card is a type containing 'rank' and 'suit' to specify an individual card. Create functions which work on this array to - initialise: from 2 of clubs to ace of spades in linear order - shuffle: to randomise the deck - deal: take the next card | |
Re: An excellent example of how not to post a question, if anyone cares. > plz help me plz plz plz plz plz plz Don't sound like an illiterate boob [url]http://www.catb.org/~esr/faqs/smart-questions.html#writewell[/url] > Write a program that can simulate the following CPU scheduling algorithms: Don't beg others to do your own homework. … | |
Re: You'll also need a good solid 6 months of daily study (several hours per day), and a good long stretch afterwards of daily use (say a couple of years) to really hone your skills. | |
Re: 1. Use code tags when posting code. 2. NEVER use gets [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1049157810&id=1043284351[/url] 3. fflush (0); What on earth is this? It may be trying to be fflush(stdin); Either way, it's wrong [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1052863818&id=1043284351[/url] | |
Re: 1. AAAA needs 5 characters of storage, not 4 2. Unlike fgets, the count you supply to scanf does not take into account the need for a \0. 3. Trying to use sizeof() with scanf is horrible. There is no easy way to automatically tell scanf what the size of … | |
Re: I wonder what the minimum path between being given your assignment and you finding a brower to post your homework on a message board was. My guess is it was a straight line. Take a detour via this [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] then try again. | |
Re: Please don't tell me that's followed by [INLINECODE]strcpy( cp, tbuff );[/INLINECODE] If it is, it's a bug. There is no space for the \0 at the end of the string. 1. In C++, it would be [INLINECODE]cp = new char[ strlen(tbuff) + 1];[/INLINECODE] 2. If you're REALLY converting it to … | |
Re: [url]http://clusty.com/search?query=linux+webcam+howto[/url] Use the "howto" keyword when searching for a lot of Linux information. | |
Re: > #define SalesPerFile "sper.dat" Seems pretty obvious, this is the name you used inside the program. Simply change it to match the actual name you've given the file. | |
Re: Your second loop should use j as a subscript for your array, not i If you wrote [INLINECODE]for( int i = 0; i < MAXSIZE; ++i )[/INLINECODE] rather than declaring the variable at the start (in C style), then a newer compiler would have made i go out of scope, … | |
Re: Heh, that was an interesting problem. > 1) You do not wish to use ANY local variables at all, so the only variable allowed in the function is the pointer to the string. Check. > 2) Using another function is not allowed. Check. > 3) You want to remove all … | |
Re: > I'm using the library "memory.h" Now what stone-age-16-bit fossil are you using perchance? | |
Re: > makewords( int a, int b, int c); How does this match your description of a function taking 3 strings? Read up on the string class. There is plenty of functionality to say - find a space in a string - return sub-strings of a string. - get the length … | |
Re: Better yet, use a std::string and not those messy char* arrays. | |
Re: > And then came if (i) or if (1234). Is it now one recursion, and how it goes on? The first recursion is i/10, which in integer arithmetic would be rek(123) After a couple more divisions by 10, you end up with a rek(0) call which goes no further. | |
Re: Like you start with [INLINECODE]int size = 10; int *array = new int[size];[/INLINECODE] And to make it bigger, [INLINECODE]int *bigger = new int[size+10]; // some stuff delete [ ] array; array = bigger; [/INLINECODE] What goes in "some stuff" is an exercise for the reader ;) | |
Re: Looks like you did a [INLINECODE]#include "common.c"[/INLINECODE] when you should have done [INLINECODE]#include "common.h"[/INLINECODE] | |
Re: In other words, unsolicited marketing emails (or private messages) or whatever else you want to call it. AKA SPAM. Explain the bit which makes it a good idea for me to help you to become a real PITA to me sometime later, because I'm just not seeing what I get … | |
Re: Only what [URL="http://www.google.com/search?q=Chkhaidze+Omar"]google tells me[/URL] Next time, use a search engine. | |
Re: > Does a simple use of fgets protect from buffer overflows Only so long as you're honest about the size of your buffer. [CODE]char buff[10]; fgets( buff, 100, stdin );[/CODE] Isn't any better than gets() OK, it's limited damage compared to gets(), but it's still a hell of a lot … | |
Re: > [INLINECODE]char month[][12][/INLINECODE] The 12 here is not for the number of months, it is for the length of the longest month name (which has only 9 chars anyway). It also forces "May" to occupy 12 characters as well (not so memory efficient). If you say [INLINECODE] char *month[] = … | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] |
The End.