6,741 Posted Topics

Member Avatar for BCBTP

[QUOTE]Yes I have seen other threads like this, but they do not really satisfy my need[/QUOTE] Then please list your requirements. The threads you speak of usually result in something like this (using Windows since you mentioned WM_KEYDOWN): [code] char& raw_input(char& ch) { HANDLE h = GetStdHandle(STD_INPUT_HANDLE); DWORD old_mode, n; …

Member Avatar for BCBTP
0
509
Member Avatar for Leaningnew

[QUOTE]fscanf returns EOF in case of errors or if it reaches eof.[/QUOTE] Specifically, it returns EOF if an "input failure" occurs before any conversion. Otherwise it returns the number of successful conversions which may be as few as zero. "Input failure" basically means anything that isn't a matching failure for …

Member Avatar for nezachem
0
77
Member Avatar for Ritesh_4
Member Avatar for sunn shine

[QUOTE=sunn shine;1662459]im new here , so i dont know how to CODE effectively.. i just copied my c++ code frm my computer, pasted it here and pressed the [code] option.. is that right or wrong?[/QUOTE] [URL="http://www.youtube.com/watch?v=6SHhxh--JT4"]Click Me[/URL]. The most important part is that your code actually have formatting. If there's …

Member Avatar for Taywin
0
297
Member Avatar for Neo_cse

That expression is undefined because you're modifying b and also accessing it for purposes other than to calculate the modification between sequence points. The rule is subtle, so I won't expect you to understand it, but do keep in mind that the expression is wrong and doesn't have predictable behavior. …

Member Avatar for Narue
0
145
Member Avatar for cwarn23

[QUOTE]but next to it the black light indicating negative rep.[/QUOTE] Negative rep is colored red, not gray. Gray boxes are used for the Community Center (where rep points don't count), and users who have too little rep power to affect you.

Member Avatar for cwarn23
0
151
Member Avatar for nuliknol

[QUOTE]is there a way to do 128 bit comparison in one instruction with SSE 4.2a?[/QUOTE] No. [QUOTE]If not, what would be the fastest way to compare with two steps of 64bit comparisions?[/QUOTE] Compare the high quadword, then the low quadword if the high quadwords are equal.

Member Avatar for untio
0
90
Member Avatar for Zssffssz

By 'without using system("color hex")' do you still mean "works on all systems magically"?

Member Avatar for Narue
0
204
Member Avatar for Zssffssz

The best alternative is not to clear the screen. Most of the time when I see things like [iCODE]system("cls")[/iCODE] or [iCODE]clrscr()[/iCODE], there's no legitimate reason for clearing the screen. However, since you're using Windows you might consider the Win32 API as a reasonably portable (on Windows) solution. If you're dead …

Member Avatar for Narue
0
139
Member Avatar for dev90

[QUOTE]Thank you... (1) so it is like that, we can not read float values directly??? and can u please tell me about these two lines. extern void float conetor(); #pragma extref floatconnector it is for reading float value directly and even though i was getting error. [/QUOTE] [url]http://c-faq.com/fp/fpnotlinked.html[/url] [QUOTE](2) and …

Member Avatar for Narue
0
156
Member Avatar for ayesha08

Not enough information. Since you're declaring TotalCS, I would assume that you have an error where TotalCS is declared in a scope that isn't visible at the time of that expression. However, I can't say for sure with so little code. Trim your program down to bare bones (without removing …

Member Avatar for Evilfairy
0
236
Member Avatar for ravi543

The function needs to be declared before its first use either with a prototype or by placing the definition prior to main().

Member Avatar for ravi543
0
101
Member Avatar for FRGT/10
Member Avatar for stereomatching

[QUOTE]What is the meaning of using dynamic_cast without any error handling?[/QUOTE] It means the author was confident that the cast would succeed. That's somewhat foolish in my opinion. Except for the most basic of code, you can't easily make such a guarantee. [QUOTE]I find out one thing, even I didn't …

Member Avatar for stereomatching
0
241
Member Avatar for Master Mascus

You don't want to do it that way. Use an array instead, where you would otherwise be tempted for name1, name2, name3, ..., nameN variables: [code] int (*tickets)[6] = malloc(bet * sizeof *tickets); for (int x = 0; x < bet; x++) { printf("Enter the 6 numbers ( 1 - …

Member Avatar for Master Mascus
0
140
Member Avatar for stereomatching

[QUOTE=stereomatching;1660751][code] void testRR(std::string &A); [/code] [code] void testRR(std::string &&A); [/code] Which one is better? [/QUOTE] You should prefer lvalue references to non-const for things you want to modify and lvalue references to const for things you can't or don't want to modify (rvalues are neatly handled here). In other words, …

Member Avatar for stereomatching
0
124
Member Avatar for Kron

[QUOTE=limaulime;1660935]OK, I think I get it. You don't have to have "case" for each character, but you can use logical operand because based on ASCII each character has it's own number. Example: if you want to check for lower case characters [CODE]if ((ch>='a') && (ch<='z')) { cout <<"lower case " …

Member Avatar for Narue
0
239
Member Avatar for football.12345

The extra 00 is the 0 you tacked onto the end of [ICODE]source[/ICODE]. You should initialize ecx to SIZEOF source - 1, since that 0 is a sentinel rather than a value character.

Member Avatar for Narue
0
216
Member Avatar for WASDted

"void mainers are DOOMed" "Geeks Lounge Junkie" "Banned" "Programming Forums Survivor" "What is Area 51?" "Superduper Mod"

Member Avatar for Netcode
0
989
Member Avatar for OblibSystems

[QUOTE]Your second comment is that C is still after many years the main programming language[/QUOTE] Being "honored" (or even "widely used") and being the "main programming language" are two completely different things. [QUOTE]So i tell you what, THINK about your replies before you post them, thanks a lot dear![/QUOTE] Follow …

Member Avatar for sergent
0
391
Member Avatar for linux

You're not properly resetting between persistence iterations. For example, x doesn't get reset to 1.

Member Avatar for linux
0
124
Member Avatar for bckc
Member Avatar for Vidgie65

Please post a complete program that exhibits the problem. If you think the current complete program is too large, remove stuff (without losing the error) until it's small enough to post.

Member Avatar for Moschops
0
265
Member Avatar for syaminismail

[QUOTE=syaminismail;1660437]please help me friends....huhuhuhu... im so need this answer now for present tomorrow....huhuhu[/QUOTE] This thread is now closed as it's in violation of our homework rule.

Member Avatar for Narue
0
224
Member Avatar for Master Mascus

There's a newline left in the stream the second time you call start(). Do some research on this, it's a classic and [u]very[/u] common problem.

Member Avatar for Narue
0
126
Member Avatar for dospy

[QUOTE]what do you mean by K?[/QUOTE] He means that the iostream library takes up more space in the executable than the stdio library after compilation. It's not an unreasonable concern, but shouldn't be the [I]only[/I] concern when choosing between iostream and stdio.

Member Avatar for dospy
0
271
Member Avatar for ntrncx

[QUOTE]i counted variables,consts,commas,references everything seems to be ok...[/QUOTE] I see a missing const in your definition, but I think a bigger issue is that you're passing way too many parameters. If you find yourself passing more than three, there might be something wrong with your design.

Member Avatar for dospy
0
225
Member Avatar for niyasc

Ignoring the myriad issues your code has that aren't likely to be your actual problem, this line is wrong: [code] scanf("%d",jamia[i].salary); // Wrong [/code] Since [ICODE]jamia[i].salary[/ICODE] is not already a pointer, you need to prepend it with the address-of operator: [code] scanf("%d", &jamia[i].salary); // Correct [/code]

Member Avatar for Narue
0
187
Member Avatar for vedro-compota

The compiler is right, LINE_MAX doesn't exist unless it's a library extension. I'd suggest the standard BUFSIZ, but that still won't work either because your code is severely broken. You're working with uninitialized pointers.

Member Avatar for vedro-compota
0
2K
Member Avatar for Narue

I'm digging this change. It's small, but solved threads are much more visible now. :)

Member Avatar for Netcode
1
117
Member Avatar for cpu-guy

There are two parts for the field width using %f. The first part is the total width including radix and precision. The second part is the width of the precision. A leading 0 will change the padding from whitespace to zeros: [code] printf("%020.3f\n", 123.456); /* Line 8 */ printf("%020.9f\n", 123.456); …

Member Avatar for cpu-guy
0
169
Member Avatar for Srcee

[QUOTE]I can't catch exception on windows services.[/QUOTE] Where is the exception coming from? That can be a significant reason why you aren't seeing it handled. For example, if your service creates a thread which then throws an unhandled exception, it won't be caught by the unhandled exception handler. [QUOTE]I mustn't …

Member Avatar for Mitja Bonca
0
2K
Member Avatar for Max Hydes

Basically all you need the time.h library for is slowing things down enough to produce the effect of animation: [code] #include <iostream> #include <ctime> void pause_execution(double seconds) { std::time_t start = std::time(0); while (std::difftime(std::time(0), start) < seconds) ; } int main() { std::cout << "Paused" << std::flush; for (int i …

Member Avatar for Max Hydes
0
896
Member Avatar for lastbencher
Member Avatar for ratatat

Apparently you're in the same class as another Daniweb member. Might I suggest searching for that thread? It has the same title and hasn't left page 1 yet (lazy much?).

Member Avatar for Narue
-1
66
Member Avatar for caut_baia

There isn't a single compiler that supports all of C++0x at this point. I believe GCC (starting at 4.6 or 4.7) is the closest though, if you want to play with C++0x I'd go with GCC.

Member Avatar for caut_baia
0
443
Member Avatar for maybnxtseasn

Presumably dword_8EF798 isn't a pointer, but an actual dword object. To dereference it you first need to take the address. Without the address-of operator, you'd be dereferencing whatever integer value is stored in the object, and probably get an access violation because it's not a valid address reference.

Member Avatar for Narue
0
71
Member Avatar for lastbencher

[QUOTE]What is the use of (void *)?[/QUOTE] The %p specifier expects a pointer to void (the generic pointer type in C). In cases where the address you want to print isn't already a pointer to void, a cast is used to make it so. [QUOTE]And why are the results in …

Member Avatar for Narue
0
172
Member Avatar for dospy

[QUOTE]i really need a GOOD socket tutorial[/QUOTE] The #1 recommended tutorial is [URL="http://beej.us/guide/bgnet/"]Beej's guide[/URL].

Member Avatar for dospy
0
168
Member Avatar for Zssffssz

[QUOTE]What is a good new compiler (C++ and D would be nice) for Linux?[/QUOTE] GCC is generally recommended for C++. [QUOTE]PS Is the system() function universal as in it will do the same thinge in Linux Windows and OSX[/QUOTE] It's universal in that you can use it, but the argument …

Member Avatar for limaulime
0
228
Member Avatar for amulgarg

[QUOTE]Its a long time doubt and no one really gives a clear and confident answer to this one.[/QUOTE] Because there's not a clear answer. Different compilers are free to do it in different ways provided the effect is the same. However, typically local variables will all be allocated to the …

Member Avatar for limaulime
0
101
Member Avatar for niyasc
Member Avatar for murnesty

[QUOTE]if you check the ASCII table, '\0' is called NUL and has been named so because it has no resemblance with the NULL pointer.[/QUOTE] This is a sticky area. Technically, '\0' has a numeric value of 0, which means it's valid as a null pointer constant, and thus equivalent to …

Member Avatar for NP-complete
0
164
Member Avatar for Master Mascus

The usual method is seeding rand() with the current time: [code] #include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { int i; srand((unsigned)time(NULL)); for (i = 0; i < 10; i++) printf("%3d", rand() % 100); putchar('\n'); return 0; } [/code]

Member Avatar for Narue
0
158
Member Avatar for anujthefuhrer

We're not your personal computing reference. Go do some research instead of bothering people with questions that could be easily answered by searching the web or reading manuals.

Member Avatar for doug65536
0
100
Member Avatar for anujthefuhrer

[QUOTE]I don't understand why you have done b++[/QUOTE] Negative indices are syntactically allowed, but the index also has to be valid. Arrays in C are 0-based, which means if you want to index them with negative values, you need to shift the "beginning" of the array forward enough to make …

Member Avatar for Narue
0
189
Member Avatar for lastbencher

malloc() and free() are declared in <stdlib.h>, you failed to include that header.

Member Avatar for lastbencher
0
155
Member Avatar for Shodow

[QUOTE]Use fgets instead , since scanf is not considered safe.[/QUOTE] scanf() is perfectly safe when used correctly. The problem is things like %s without a field width where the programmer has no clue that it's a buffer overflow waiting to happen. If scanf() is so unsafe, then why is the …

Member Avatar for Narue
0
556
Member Avatar for Brandon1363

Your interview has no unique questions, try searching the forum for previous people asking the same thing. After a few dozen times, it gets old for those of us being interviewed.

Member Avatar for Brandon1363
0
268
Member Avatar for bettybarnes

[QUOTE]Other than academic, there is no good reason to translate it.[/QUOTE] Unless you're writing a C compiler. It's not unusual to have intermediate assembly language output which is subsequently fed to an existing assembler that produces the final object code.

Member Avatar for AceStryker
0
321

The End.