636 Posted Topics
Re: Yes you can (sort of), however it is fairly non-trivial. The last parameter to sa_sigaction is a pointer to ucontext_t of a faulting context. Among other things, it includes uc_mcontext (describing the complete state of the cpu). It in turn contains a gregset array og general purpose registers. Now, gregset[REG_EIP] … | |
Re: You never change the clipboard contents. You only copy the text into some global memory, which has no association with a clipboard. Look at SetClipboardData function. | |
Re: Look [URL="http://webster.cs.ucr.edu/Page_TechDocs/pe.txt"]here[/URL], specifically in the discussion of "bound imports". This is the only use I am aware of. | |
Re: Add the line [CODE] cout << "fact = " << fact << endl;[/CODE] right after line 24, and see what happens. | |
Re: Most of the linux development is driven by commercial enterprises. Linux is a great vehicle to sell the hardware to OEMs, be it in form of an evaluation kit or a reference design. Every hardware designer wants linux to run on their platform; usually up to 10% of the software … | |
Re: The Ubuntu version does not match the original. For example, [ICODE]-L/usr/local/difmap2.4k/lib -lsphere[/ICODE] has different meaning than [ICODE]-L/usr/local/uvf_difmap/lib/libsphere[/ICODE] Try this: [CODE]g++-4.5 -o splitc splitc.o -L/usr/local/uvf_difmap/lib/ -L/usr/lib/x86_64-linux-gnu -lsphere -llogio -lpager -lcpgplot -lpng -lpgplot --lX11 -lfits -lrecio -lscrfil -lslalib -ltecla -lcurses /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/libgcc.a[/CODE] As of what to do with the build script, make sure … | |
Re: [QUOTE] X-- --- --- Perfect 1st move for Tic Tac Toe![/QUOTE] To begin with, I wouldn't call it perfect. Now, if you are sure that the alpha-beta works correctly (I didn't bother to check), then the problem must be in a statical evaluation. And it is there indeed. Hint: pay … | |
Re: [QUOTE]Is there another way I am not considering? [/QUOTE] [CODE]> gcc -c foo.c > gcc -c bar.c > gcc -o baz foo.o bar.o >[/CODE] Of course an object file can be linked. In fact, only the object files are linked. A library is a convenient way to package a collection … | |
Re: It is a very bad habit to use an asterisk in the dependency. Consider the situation: foo.c bar.c are the sources. For some reason foo has been compiled into foo.o, but bar.c was not. The directory contains foo.c, bar.c, and foo.o. The dependency *.o at line 4 in your makefile … | |
Re: 0. The installer makes end users comfortable. 1. An end user is more or less sure that the thing she installs is what it claims to be. See bullet 0. 2. Most applications need third party libraries, drivers, services, registry settings, and whatnot (not to mention previous versions and cross-version … | |
Re: [QUOTE]Does anyone have any ideas?[/QUOTE] Of course. Assigning a pointer does not copy the string contents: [CODE] g_ppRecords[g_numRecords]->firstName =(char*) malloc(sizeof(token)); g_ppRecords[g_numRecords]->firstName = token; [/CODE] Now firstName points to token, not the memory you've allocated. That is, firstName in every record points somewhere into the input array, and most likely to … | |
Re: You calculate the position of the new environment variable (line 81) based on the length of the current one. It is OK as long as you use the original length. In case of PATH it is not so. | |
Re: A mandatory [URL="http://lwn.net/Kernel/LDD3/"]reading[/URL]. | |
Re: First of all, explain the loops [CODE] for (Y=y1; y2!=Y ;Y++){[/CODE] at lines 110 and 144. I am asking because the loop parameter Y is not used in the loop body. Second, (re)read [URL="http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm"]an article[/URL] on a Bresenham algorithm until you understand completely how it works. | |
Re: Yes. At lines 23, 30 and 34 the behavior is undefined. The improvement is obvious. | |
Re: The problem is that a Weierstrass product converges very poorly (my gut feeling is that it is worse than linear; correct me if I am wrong). That is, even 1e8 iterations may not be enough. | |
Re: [QUOTE]skip 16bit it is dead[/QUOTE] I wouldn't be so definite. 16-bit is very well around (and, ugh, 8-bit too). Their niches are very specific indeed, but really, 8-bit is the only area where assembly programming skills still have value. | |
Re: [ICODE]#define[/ICODE] is a textual substitution. The expression expands to [CODE] i < j > k? j: k[/CODE] I leave it as an exercise to figure out the actual precedence. To avoid such mess, you need to be more explicit: [CODE]#define max( a, b) (a > b ? a:b)[/CODE] Notice an … | |
Re: Well something must be different. My first recommendation is to attach a debugger, and figure out what exactly is failing. My second recommendation is to get rid of system(), and use rename() and unlink(); if you insist on system(), at least spell out explicit paths to mv and rm. | |
Re: Very long and detailed [URL="http://www.ietf.org/rfc/rfc2616.txt"]explanation[/URL] | |
Re: Define a generic node type; somewhat akin to [CODE]typedef struct node_s { enum node_type_t node_type; void * node_specific_data; node_s ** children; } node_t;[/CODE] You may need other fields as well. Define "node constructors" for each language entity (terminals and nonterminals alike). In the semantic action for each rule, call a … | |
Re: [QUOTE]void not ignored as it ought to be[/QUOTE] because you are not passing the function to the thread. You are calling it (notice [ICODE]()[/ICODE] in [ICODE]FunctionToPass()[/ICODE] at line 21), then try to dereference the result (notice [ICODE]*[/ICODE] there). Since FunctionToPass is void, the compiler complains. | |
Re: The code breaks the loop when ftell(p) returns -1. At what circumstances do you expect this to happen? | |
Re: [QUOTE=tkud;1731613]That was not what I meant. In my own opinion, the OP meant that a user-defined function can run AFTER main() has ended, of which I try to explain that if main() has ended, the program has ended.[/QUOTE] Even that is wrong. Add a [CODE] ~foo() { std::cout << "Me … | |
Re: [QUOTE]a bunch of preceding syntax errors[/QUOTE] They are probably much more relevant. Start with the first one. PS: I bet you are missing a semicolon somewhere in one of your .h files. | |
Re: Why do you need test? Read directly to where you want it to be. Of course, you can also [ICODE]memcpy(name[i], test.name, sizeof(test.name))[/ICODE]. | |
Re: Newton-Raphson, of course. I expect you already implemented addition and division. | |
Re: [QUOTE]it says the the length of the string is 14h [CODE]src DB 'abcdefghi$' dst DB 10 dup(0) len DB EQU $-src[/CODE][/QUOTE] Yes, that's exactly what should happen. A $ sign at the line 3 is an assembly pointer, and its goal is to trace addresses at which the code is … | |
Re: Since the thread appears in the C forum, I can't recommend boost::asio (and I didn't). Depending on which platform you are targeting, you may look at the IO completion ports, WaitForMultipleObject(), [e]poll(), or select(). The latter is really the largest common denominator of all IO muxing techniques; it is somewhat … | |
Re: [B]> But, when I try to define data in another line of code, I get cross-type errors.[/B] Can you show how you do it? | |
![]() | Re: The presence of flags, and special casing of certain conditions usually indicate that something is wrong. For example, on a very first insertion you compare temp with arr[0], which has a garbage value. If that comparison fail, the next comparison accesses arr[count], and count is -1. Welcome undefined behaviour. Looking … ![]() |
Re: Correct me if I am wrong, but for me [I]HTTP Version Not Supported[/I] means exactly what it says: HTTP version (1.1 in your case) is not supported. Try HTTP/1.0 instead. | |
Re: man strftime. The format string you need is "%Y-%m-%d %H:%M:%S". | |
Re: The main loop should fill the array (not print it, but just fill) in the following manner: [CODE] K steps to the right K steps up increment K K steps left K steps down increment K [/CODE]Break the loop as soon as K reaches N. Of course, each step increments … | |
| |
Re: There's a bunch of issues with the code. 1. An argument DevicePath of DisplayVolumePaths shadows the global DevicePath. 2. You are printing DevicePath[1] regardless of how many paths has been found. 3. Most important problem: DevicePath is populated with pointers to memory which is deleted at line 60. | |
Re: When your server starts sending a large file (line 195) it stops paying attention to incoming data, until the file is completely transmitted. Its incoming buffer fills up. After that, the client can't send anything and gets stuck at line 90. The server keeps sending. Client's buffer fills up. Now … | |
Re: > i need to check there is at least one factor between the numbers before i call the gcd method on them. No. You need to fix the gcd code. Hint: any two numbers have a common factor 1. | |
Re: > for some reason the ReducedFraction function is not working Perhaps, because you never call it. | |
Re: Index, in fact. It's a long-standing math tradition. From math it was assumed by Fortran (which is Formula Translator), where anything starting with I, J, K, L, M and N was implicitly integer. Then it became a programming tradition. | |
Re: a) Yes b) C++ does not address this d) Sort of (due to e) e) Very much f) Start [URL="http://stackoverflow.com/questions/558848/can-i-force-cache-coherency-on-a-multicore-x86-cpu"]here[/URL], then try to apply those ideas to your architecture (if it is not x86). ![]() | |
Re: What error are you getting? Replace line 24 with [CODE] printf("connect: %s\n", strerror(errno));[/CODE] Don't forget to #include <errno.h> | |
Re: The problem has nothing to do with 64 bit types. Values you read are not garbage, but a very valuable port definitions: [CODE]struct ofp_phy_port ports[0]; /* Port definitions. The number of ports is inferred from the length field in the header. */[/CODE] Which means, once you've [CODE]recv(connected, &features_rep, sizeof(features_rep), 0)[/CODE] … | |
Re: [URL="http://www.daniweb.com/software-development/cpp/threads/381899/1644654#post1644654"]Deja vu[/URL]? | |
Re: You have to [I]call[/I] main somehow. Usually, it is [CODE]if __name__ == '__main__': main()[/CODE] | |
Re: Think of the case of a list with 2 elements. Once you've deleted the last one, where does _first->_fore point to? BTW, same applies to _last->_fore in a general case. | |
Re: You have to understand how fscanf works. Where does it store the result of conversion, and what does it return. In your case, all the numbers you read end up in [ICODE]input[/ICODE], while [ICODE]input1[][/ICODE] collects return codes (which all happen to be 1, indicating successful conversion of one field). | |
Re: The problem is not so much equal condition (which is infinitesimal), but the fact that you recalculate random(). In the failing case, [CODE]## if random()*probA > random()*probB: ## scoreA = scoreA + 1 ## elif random()*probA < random()*probB: ## scoreB = scoreB + 1[/CODE] the fact that team A loses … | |
Re: As usual, "doesn't seem to work" is not a helpful description of the problem. My wild guess is that you do not account for the newline character (which does appear in buff), and becomes an inherent part of certain words. |
The End.