5,237 Posted Topics
Re: Well the first thing I would suggest is (if you're going to use the C API in a C++ program) is to read the line into a buffer, then use sscanf() Next, I would suggest you treat each (%d,%d) as a single input routine, and call that 4 times in … | |
Re: [url]http://www.catb.org/~esr/faqs/smart-questions.html#bespecific[/url] | |
Re: Well your first handicap is that Turbo C will know nothing about USB. I'm going to make a guess that your operating system is XP - am I right? | |
Re: Use fgets() to read each line into a buffer. Use strtod() to convert each float, and advance a pointer through the buffer. A simple way would be to read the whole file just to determine the dimensions of the array you would require, then call malloc to allocate all the … | |
Re: Well that would depend on your compiler. gcc with something like -Wall does. As does say /w4 with visual studio express. | |
Re: Well what way(s) did you figure out so far, so we don't duplicate all the simple ones you know about so far. | |
Re: [url]http://www.daniweb.com/forums/post505787-3.html[/url] OOP is equally applicable to console programs as well as GUI programs. In fact GUI programming is just a matter of learning an API. Whether you use Win32 GDI, MFC or wxwidgets. Creating a large a program needs a lot of other skills like analysing requirements, producing a design … | |
Well are you? So, irrespective of the type of rep you give, why is the word "lucky" in the popup? Surely receiving rep is far more deterministic than the pure blind chance it suggests. Perhaps when rep was blind and could be given anonymously, there was an element of chance. … | |
Re: > -- invalid conversion from `const char' to `const CHAR*'-- The [n] subscript is doing that. You need to generate the filename string, with n appended, before you pass it to CopyFile(). In C, I'd use say sprintf(), but in C++ I think a string stream would be more appropriate. | |
Re: It means you created a windows project (which expect to start at WinMain), but you've written a console program which begins at main(). Easiest thing is to create a new console project and copy your program to it. | |
Re: A web search will tell you how many solutions there are. | |
Re: 1. Unspecified initialisers default to zero, so [iCODE]int arr[5] = { 1, 2 /* 0, 0, 0 */ };[/iCODE] 2. The number of { } reflect the dimensionality, so [CODE]int arr[2][3] = { { 1, 2, 3 }, { 4, 5, 6 }, };[/CODE] 3. Only the left-most dimension can … | |
Re: Are you saying that just those 3 lines (and nothing else) cause a problem? Or do you then go on to do something with Feedback which actually causes the crash? A small complete program which crashes is much more useful for us to tell you where you went wrong. It … | |
Re: If all the minor dimensions are static, then you can allocate dynamically, and be contiguous with the result in one easy step. [CODE=cpp]int (*ptr)[CONST_SIZE] = new int [howmany][CONST_SIZE]; // delete [] ptr;[/CODE] If not, then you can allocate like this. It allocates space for the pointers, then space for the … | |
Re: C++ strings are in #include <string> Use this if you want a string type. C strings (strcpy et al) are in #include <cstring> | |
Re: It's not a binary file if you're using fprintf/fscanf to access the file. All the "b" mode will do is turn off any end of line translations, but since you never write a newline, this isn't an issue. Further, you don't check the return result of fscanf(). You should. If … | |
Re: [URL="http://www.daniweb.com/forums/announcement8-2.html"]Nope[/URL]. | |
Re: Why every line of your post was wrong. [url]http://www.catb.org/~esr/faqs/smart-questions.html#bespecific[/url] [url]http://www.catb.org/~esr/faqs/smart-questions.html#explicit[/url] [url]http://www.catb.org/~esr/faqs/smart-questions.html#prune[/url] [url]http://www.catb.org/~esr/faqs/smart-questions.html#noprivate[/url] | |
Re: Er, mostly the C runtime library takes care of it for you? Do you have a specific "for example..." to tell us about where this standard behaviour is a problem? | |
Re: Do you imagine you're the first person to ever ask this question? Search the board, many (many) examples can be found. | |
Re: [code] while ( something ) { switch(MENU_FLAG) { case STATUS: // Stuff MENU_FLAG = MISSION; break; case DEBRIEF: // Stuff MENU_FLAG = MISSION; break; case MISSION: // Stuff break; } } [/code] Or [code] if ( MENU_FLAG == STATUS ) { DisplayStatusMenu(); } else if ( MENU_FLAG = DEBRIEF ) … | |
Re: [url]http://www.daniweb.com/forums/thread123033.html[/url] Talk to past students who took the course to find out how useful it really was to them. | |
Re: totalspacelist=`cat $DF|awk '{print $2}` You're missing a ' Next time, use some code tags. | |
Re: Why would I care? After 69 posts you're still using void main, and still can't use code tags. Just look at what you've posted man. Unindented crap full of smilies. I've got better things to do that figure out what that supposed to mean. | |
Re: A class called 'card', which knows about suit and rank. A class called 'deck', with 52 cards in it. 'deck' has methods like 'shuffle' and 'draw'. Call shuffle, then a loop to call draw 5 times. | |
Re: Some arrays... [code] int arr[ ] = { 1, 2, 3 }; double arr[ ] = { 1.0, 2.0, 3.0 }; char arr[ ] = { '1', '2', '3' }; [/code] A char array (and only char arrays), can also be initialised like this (for convenience) [icode]char arr[ ] = … | |
Re: 1. Look up the > and >> output redirection (and < input redirection) 2. Most ed command can be prefixed with a count, something like say 20s/target/ | |
Re: [url]http://www.catb.org/~esr/faqs/smart-questions.html#writewell[/url] > iam on my ilp training so i need tht very urgently And is your "training" anything to do with learning scheme? If whoever is paying for this course finds out you're trying to scam free homework, what are they likely to say about it? Maybe if you posted … | |
| |
Re: 1. This is C++ code (such as it is). There are much better string to int conversions available than atoi 2. Use some more { }, like this [code] switch (atoi(i))//yes its an int 1,2,3,... etc... { case 1: [COLOR="Red"][B]{[/B][/COLOR] R S(r, h);//create new class R object named S,to constructor … | |
If you were given the job of creating a new "Rosetta Stone", which three languages would you choose, and what would you write on it? | |
Re: [URL="http://clusty.com/search?query=how+to+write+a+windows+service&sourceid=Mozilla-search"]Clickety Click[/URL] Like typing your question into a search engine? | |
Re: Avoid csh [url]http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/[/url] | |
Re: Wireshark is an extensible protocol analyser. | |
Re: Well if your rand() is say 16 bits, and you want 32 bits, you could do this [ICODE]unsigned long result = ((unsigned long)rand()) << 16 + (unsigned long)rand();[/ICODE] Just join 2 rands together. For a much better random source, look at the boost library. The standard rand() has no guarantees … | |
Re: Open the input file for reading Open an output file for writing [ICODE]while ( fin.getline(myLine) ) { }[/ICODE] Close input file Close output file Now in the while loop you - write the line unchanged - write a different line - don't write the line at all. | |
Re: Once you get past the size of programs which you can write yourself, there is an awful lot to writing a program which isn't actually writing a program. Requirements, design, testing, configuration management and all sorts of other skills come into play. At the very least, your course should have … | |
Re: Don't such things normally come with a whole load of support services as well to help lock you into whatever the vendor has sold you? I'm wondering what the basis of the decision was all of a sudden. Or perhaps you're just conducting a survey, so I'll answer "no". | |
Re: You can't strtok more than one string at the same time. Meaning you can't start tokenising another string and then resume tokenising the original string. Here are some alternatives. [url]http://www.hmug.org/man/3/strsep.php[/url] [url]http://www.manpages.com/man/strtok_r[/url] | |
Re: That's more like multi-profile support, rather than multi-player support. For what you want, just prompt the user for the filename they want to load, rather than hard-coding "datafile.dat" in the source code. | |
| |
Re: [url]http://sourceforge.net/search/?type_of_search=soft&type_of_search=soft&words=webcam[/url] | |
Re: No, he desperately needs to get off his ass and buckle down to some work. > It has to be done in couple of hours as he has an exam tomorrow Oh goody, [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] I suppose by tomorrow there'll be one less wannabe programmer who thinks they can get by … | |
But not the kind you're thinking of (I would say). [url]http://news.bbc.co.uk/2/hi/health/7412719.stm[/url] | |
Re: Well you could post what you tried in a new thread, rather than hijacking an old thread with "it doesn't work". IIRC, DAA mean you turn say a numeric value of say 0x42 (aka 66 decimal) into 0x66. You still need to extract each nibble and add '0' to it … | |
Re: Yeah, whatever.... [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] | |
Re: Why so much C code in a C++ program? Besides, if you're using 'char', then a char array would be simpler. If you allocate it yourself, then you have to remember to deallocate it as well. | |
Re: [url]http://msdn.microsoft.com/en-us/library/ms682087(VS.85).aspx[/url] | |
Re: 'is' functions return a boolean result ('is' true or isn't true, otherwise known as false). So [CODE]if ( isdigit(letter) ) { number++; }[/CODE] Oh, and in C++, use [ICODE]#include <cctype>[/ICODE] |
The End.