5,237 Posted Topics

Member Avatar for wellibedamned

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 …

Member Avatar for wellibedamned
0
114
Member Avatar for computers08

[url]http://www.catb.org/~esr/faqs/smart-questions.html#bespecific[/url]

Member Avatar for Salem
0
294
Member Avatar for champnim

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?

Member Avatar for champnim
0
177
Member Avatar for rob_xx17

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 …

Member Avatar for Salem
0
102
Member Avatar for VernonDozier

Well that would depend on your compiler. gcc with something like -Wall does. As does say /w4 with visual studio express.

Member Avatar for fierykido
0
1K
Member Avatar for k2k

Well what way(s) did you figure out so far, so we don't duplicate all the simple ones you know about so far.

Member Avatar for omrsafetyo
0
138
Member Avatar for Extremus

[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 …

Member Avatar for Ancient Dragon
0
134
Member Avatar for Salem

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. …

Member Avatar for majestic0110
4
69
Member Avatar for CodeBoy101

> -- 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.

Member Avatar for CodeBoy101
0
135
Member Avatar for joshuabraham

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.

Member Avatar for William Hemsworth
0
96
Member Avatar for dobado
Member Avatar for Clockowl

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 …

Member Avatar for Salem
0
272
Member Avatar for savinki

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 …

Member Avatar for Salem
0
95
Member Avatar for VernonDozier

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 …

Member Avatar for Prabakar
1
2K
Member Avatar for mustafaneguib

C++ strings are in #include <string> Use this if you want a string type. C strings (strcpy et al) are in #include <cstring>

Member Avatar for mustafaneguib
0
166
Member Avatar for MiTiM

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 …

Member Avatar for MiTiM
0
2K
Member Avatar for ranjithsnair
Member Avatar for jephthah
0
51
Member Avatar for AHMADI110

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]

Member Avatar for jephthah
1
76
Member Avatar for rocky1821

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?

Member Avatar for Salem
0
70
Member Avatar for towhidd

Do you imagine you're the first person to ever ask this question? Search the board, many (many) examples can be found.

Member Avatar for WaltP
0
283
Member Avatar for phalaris_trip

[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 ) …

Member Avatar for Duoas
0
274
Member Avatar for jedwards1150

[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.

Member Avatar for jedwards1150
0
206
Member Avatar for rpnalluri

totalspacelist=`cat $DF|awk '{print $2}` You're missing a ' Next time, use some code tags.

Member Avatar for rpnalluri
0
262
Member Avatar for zawpai

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.

Member Avatar for Nick Evan
0
319
Member Avatar for Black Magic

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.

Member Avatar for Salem
0
101
Member Avatar for Kadence

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[ ] = …

Member Avatar for Salem
0
204
Member Avatar for k2k

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/

Member Avatar for Salem
0
164
Member Avatar for SACHIN4TCS

[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 …

Member Avatar for sarehu
-1
260
Member Avatar for shankhs
Member Avatar for shankhs
0
102
Member Avatar for mihal
Member Avatar for Onixtender

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 …

Member Avatar for Onixtender
0
83
Member Avatar for Salem

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?

Member Avatar for twomers
0
66
Member Avatar for pa3k80

[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?

Member Avatar for Salem
0
113
Member Avatar for k2k
Member Avatar for Salem
0
447
Member Avatar for Nickker22
Member Avatar for vieestchien

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 …

Member Avatar for tesuji
0
84
Member Avatar for joshmo

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.

Member Avatar for VernonDozier
0
183
Member Avatar for PhiberOptik

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 …

Member Avatar for Abzero
0
100
Member Avatar for TieniedeKlerk

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".

Member Avatar for hehal83
0
107
Member Avatar for savinki

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]

Member Avatar for saandeep_jan
0
1K
Member Avatar for siripong153

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.

Member Avatar for siripong153
0
106
Member Avatar for hazmatt
Member Avatar for charkac

[url]http://sourceforge.net/search/?type_of_search=soft&type_of_search=soft&words=webcam[/url]

Member Avatar for jephthah
0
2K
Member Avatar for cyruski

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 …

Member Avatar for jephthah
0
131
Member Avatar for Salem

But not the kind you're thinking of (I would say). [url]http://news.bbc.co.uk/2/hi/health/7412719.stm[/url]

Member Avatar for bumsfeld
0
141
Member Avatar for andiey

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 …

Member Avatar for Salem
0
105
Member Avatar for Leil@

Yeah, whatever.... [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url]

Member Avatar for jephthah
1
98
Member Avatar for CoolGamer48

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.

Member Avatar for mitrmkar
0
85
Member Avatar for jmines
Member Avatar for Salem
0
167
Member Avatar for computer engW

'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]

Member Avatar for computer engW
0
181

The End.