5,237 Posted Topics
| |
Re: Have you done the OpenGL tutorial at [url]http://nehe.gamedev.net/[/url] ? | |
Re: Try fwrite(head Note that you're writing pointers (in the next field) directly out to disk. You need to make sure that you ignore this field when you next read the file into memory, because those pointers will be meaningless. | |
Re: > I am wondering if it makes sense that optimizating with a compiler change the > outcome of the solutions. Sure it can, if there are bugs or unwarranted assumptions in your code, all sorts of things can break. At -O3, your code needs to be pretty darn perfect to … | |
| |
Re: Pretty much. But you need to post your actual code and better observations than "it doesn't work" for a better response. | |
Re: > while(!feof(fp)) { > if(fgets(str, 126, fp)) You can say this more succinctly with while ( fgets( str, sizeof str, fp ) != NULL ) A point to note, you don't have to adjust the buffer size when calling fgets. | |
Re: > Would you have to hold the match to his mouth? Cows are female, and that's no bull :icon_lol: | |
Re: Well the first thing you need to research is the [URL="http://clusty.com/search?query=wav+file+format&sourceid=Mozilla-search"]WAV file format[/URL] You'll also need to be familiar with the bitwise operators << >> & | ^ in order to pack information at the bit level. | |
Re: Trying to call it before you prototype it will cause the compiler to declare it implicitly. This implicit declaration will almost certainly conflict with the actual definition you provide later on. | |
Re: You can't seek() on a text file unless you use the result of a previous tell(). Because of all the line translation which happens, you can't reliably calculate the start position of any given line (except the first line obviously). Also, updating a text file one line at a time … | |
Re: zhelih needs to read post [URL="http://www.daniweb.com/forums/post503250-2.html"]#2[/URL] as well. Like the bit on how to declare main, and the correct name for header files. | |
Re: I'm perfectly content to sit here and watch you fail actually. Here is only a subset of forums rules which you've already broken. Feel free to read them and reflect on what they're saying before you just dump your homework. [url]http://www.daniweb.com/forums/announcement8-2.html[/url] [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] [url]http://www.catb.org/~esr/faqs/smart-questions.html#writewell[/url] [url]http://www.catb.org/~esr/faqs/smart-questions.html#noprivate[/url] | |
Re: > getch() is executed before the file is displayed.! > whats wrong? The problem is is that you're mixing methods of input and output. getch() being a low-level, compiler specific function is likely to bypass all the higher level (and probably buffered) functions. What's worse is that getch() is horribly … | |
Re: > Please let me know if I am wrong. If you're going to have any chance of winning these arguments, you need to quote "chapter and verse" from the relevant ANSI standard, not just demonstrate what your current "foo" compiler happens to do with one specific test case. Because there's … | |
Re: 1. Your code is C, not C++ (wrong forum) 2. Your post has nothing to do with the other posts in this old thread 3. You didn't read this - [url]http://www.daniweb.com/forums/announcement8-3.html[/url] 4. printf("%d is greater than %d\n"[COLOR="Red"][B],[/B][/COLOR] &num1, &num2); You're missing a comma 5. if (num1 =< num2) =< isn't … | |
Re: I saw the same thing a couple of weeks ago-ish, using Firefox, but it didn't last long enough to get worried about. | |
Re: [url]http://en.wikipedia.org/wiki/List_of_widget_toolkits[/url] There are a number of cross-platform GUI toolkits. | |
Re: For sure you need a compiler which actually matches your OS, and doesn't just live inside the DOS emulation layer of your OS. > I have Intel Core 2 Quad Q6600 2.4 Ghz processor Yes, and despite all that, all that your programs will ever see of that machine is … | |
| |
Re: I no longer watch broadcast TV 'live', but instead record everything I want to watch on a PVR. Man, gotta love the 30x fast forward feature to blast over all the boring bits. Efficient too, I can get 2 hours of broadcast time down to just over 90 mins of … | |
Re: > Did you find any solution yet? Did you bother to check the post dates? | |
Re: > void main() This is wrong, main returns int. [url]http://c-faq.com/ansi/voidmain.html[/url] [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044841143&id=1043284376[/url] > gets() [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1049157810&id=1043284351[/url] And while I'm on a roll, try this as well [url]http://www.catb.org/~esr/faqs/smart-questions.html#writewell[/url] The real problem is you're mixing scanf() with gets() (ugh!!!) and getchar() If you mix and match, as you're doing, then you'll come unstuck. The … | |
Re: > the compiler just hangs there without any response. The compiler is all done if you've got an a.out file. If that isn't responding, it can only be your source code which is at fault. You need to post some for further enlightenment. | |
Re: > also please tell me which of the comments I should remove All of them? Example: [icode]else if(in[i]=='.') //if '.' is encountered[/icode] How is that comment adding anything to the understanding? Comments which essentially repeat the syntax of the language don't add anything. Anyone reading the code could write those … | |
Re: [url]http://en.wikipedia.org/wiki/Decompiler[/url] Decompilation is like trying to get flour and eggs back from your cake. Getting "something" which might compile is fairly do-able, but the results are only something a compiler could love. It will in no way resemble the source code which was originally compiled. For example, a for loop … | |
Re: Got search-engine-phobia or something? [url]http://www.google.co.uk/search?q=Simplified+Data+Encryption+Standards&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a[/url] | |
Re: Your code is poorly indented. The variables are undeclared. The variable names are meaningless. > if(c==" ") This is meaningless in a C program, you can't compare arrays of chars like this. > /*this ode may be useful for converting a usual statemnt to poland model*/ Huh? It's the only … | |
Re: > i'am using sscanf and its working ok i think but how can i get it to ignore the " and spaces parts But you started off using C++ ? So why aren't you still using C++ APIs, like AD mentioned in post #3 | |
Re: Perhaps a better example of how the input relates to the output would help us make some suggestions. It could be binary for all I know. If you intend to store the results in memory, then the condensed output needs to be at most a few hundred MB in size … | |
Re: [URL="http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Option-Summary.html#Option-Summary"]Options for GCC[/URL] [URL="http://msdn2.microsoft.com/en-us/library/9s7c9wdw(VS.80).aspx"]Options for Microsoft C++[/URL] [URL="http://dn.codegear.com/article/20997"]Options for Borland BCC32[/URL] | |
Re: You normally have two builds to choose from, "Debug" and "Release". Choose the debug build. You'll still get warnings about no labels, but those should all be in the system DLLs, but you should be able to set breakpoints etc in your own code. | |
Re: > will someone point me the reasons why a call to malloc fails even if we have enough memory ? My guess is you're still using crusty old TurboC which is limited to 640K no matter how many GB of memory you have on your pentium powered, XP hosted machine. … | |
Re: > for (int i = 1; i <= numberOfVerticies; i++) Arrays, including those you allocate, start at 0, not 1. All your examples run off the end, and no doubt end up corrupting something else. It should be [icode]for (int i = 0; i < numberOfVerticies; i++)[/icode] In your face … | |
Re: Do you want CProgramA to stay around to wait for CProgramB to finish? Which OS/Compiler are you using? | |
Re: 1. Your printf() statements in your switches need to have a trailing \n (or a call to fflush(stdout) ) to guarantee being able to see them. 2. You should really have a default case in your switch, to catch all other possible errors. | |
Re: How do you expect us to give you code, when you have the algorithm? | |
Re: > I just do it, because it doesn't work. So post your best effort to date. Or if it's a large amount of code, create a cut-down version which specifically demonstrates the problem you're facing. Sometimes, the very act of doing this will tell you the answer. Even if it … | |
Re: > Can you please tell me how to solve this? Perhaps by starting your own thread, and not hijacking some thread over 2 years old. | |
Re: > Say every 5 miliseconds. Does your monitor refresh at 200Hz ? If there is no way for you to observe the effects of such a high resolution event, then what would be the point of trying it? Besides, once you get below the normal scheduling frequency of the OS … | |
Re: You don't need threads, just the ability to read user input without blocking. [code] do { if ( keypressed() ) { key = readKey(); handleKey(key); } moveFishes(); refreshScreen(); } while ( numFishes > 0 ); [/code] | |
Re: Also learn how to indent your code. It's much easier to follow the logic of your program that way (for you and for us). | |
Re: The simple way is to just compile the whole code, then have some kind of decision in the code, like this. [code] int main ( ) { if ( something ) { program1(); } else { program2(); } } [/code] A more complicated way would be to write each separate … | |
Re: > but shows an error when i run it. Thanks for narrowing it down for us :icon_rolleyes: [url]http://www.catb.org/~esr/faqs/smart-questions.html[/url] Now, how about telling us something concrete and specific (say a copy/paste of your console screen) rather than something vacuous like "an error". Have you considered the possibility that DOS was dead … | |
Re: You forgot to specify the true value of argv[0], namely [icode]execl("/bin/cp","/bin/cp","../data/data_.txt","../data/data.txt",(char*)0);[/icode] | |
Re: > and saced them under the font that I use for output Guessing "saced" is saved, then the first thing you need to do is select that font as your output font. Having selected the font, you then need to output the correct character code which matches the saved position … | |
Re: Goto [url]http://sourceforge.net[/url] Type "Intrusion AND Detection AND System" into the search box, and click "[URL="http://sourceforge.net/search/?type_of_search=soft&type_of_search=soft&words=Intrusion+AND+Detection+AND+System"]search[/URL]". | |
Re: [url]http://www.daniweb.com/forums/announcement125-2.html[/url] "help" implies that you've done something yourself, and you've reached a point where you can go no further. For example, you can print everything, but not in colour. So post what you've achieved, so we don't waste time explaining what you already know, or leave out a whole bunch … |
The End.