636 Posted Topics
Re: Your Deal function is very very wrong. It may cause all sorts of problems (including the one you observe). | |
Re: I think you've misinterpreted the situation. The {} is specific to the find utility, and has no special meaning for xargs (in fact I wonder how they are parsed at all in this context). The latter forms the command by appending the input string (as a last argument) to the … | |
Re: The way you set it up is suboptimal. Usually each object file has its own list of dependencies; having just one _DEPS for everyting leads to excessive recompilation. A typical solution uses g++ for dependency generation: [CODE] # Each .cpp will have its own .d, and the list of a … | |
Re: As you noticed, a naked * is expanded to the contents of the directory. Inside the double quotes the globbing is suppressed: [CODE]echo "$line"[/CODE] | |
Re: [B]> step around the compiler protection...[/B] ... straight into the undefined behaviour. | |
![]() | Re: fgets() (line 15 of the original post) reads not only the command line, but a trailing newline as well. The newline is never stripped, and after tokenization it is still attached to the last argument. See an extra empty line (line 3): [CODE]/bin/ls / /bin/ls / /bin/ls: cannot access / … |
Re: Are you trying to [I]execute[/I] the makefile? What about just typing [icode]make[/icode] at the command prompt? | |
Re: [QUOTE=phil750;1142187] [code] char *dir; ... getcwd(dir,50); [/code] Thanks for any help[/QUOTE] Allocating some memory for [ICODE]dir[/ICODE] would help a lot. The fact that it worked fine in some environment is just a pure (bad) luck. | |
Re: Some numbers are both multiple of 3 AND a multiple of 5. You count such numbers twice. | |
Re: A separate dll is not necessary. dlopen(0, ...) gives a handle to the main module. | |
Re: I see that the thread is solved. However, using __DATE__ and __TIME__ (which are stanadrd predefined macros) looks more straightforward... | |
Re: En is set to 0 at line 11 and never changes after that. Therefore the loop (as long as E is positive) never executes. You need to initialize En to a really big number and reevaluate it at each iteration. Adak: The code compiles and runs, and the %lf conversion … | |
Re: [QUOTE]This is the output on Solaris in the case of vfork(): Segmentation Fault (core dumped) [/QUOTE] A vforked child is confined to _exit() and execve(). Anything else causes undefined behaviour. [QUOTE]MS-Windows creates threads just like vfork, where all threads share the same memory. [/QUOTE] It does not. After vfork the … | |
Re: [QUOTE]Is there any benefit to using a child process with fork()?[/QUOTE] Definitely so. Doing everything in the same process means that you can either accept or serve. The act of serving (read the request, prepare, and send the reply) is time consuming. That is, server becomes unresponsive. NB: it is … | |
Re: [QUOTE][CODE]while(!feof(sendFile)){ fgets(send_buffer, MAX_LEN, sendFile); send(new_fd,send_buffer,sizeof(send_buffer),0); }[/CODE][/QUOTE] fgets reads a line. Most likely it is shorter than MAX_LEN. However, send() will transmit MAX_LEN bytes anyway, including all the garbage beyond the end of line. Change sizeof(send_buffer) to the actual amount of data, e.g. strlen(send_buffer). | |
Re: The result of OR is true if the first operand is true. Therefore, if it is the case (and it is, since i++ yields 1), the second operand (that is, j++&&k++) is not calculated at all. Such behaviour is required by the Standard. | |
Re: Just check errno. It should be set to EINTR. | |
Re: Line 17: Child::Add takes 2 arguments. Line 28 calls Add with 1 argument. | |
Re: Your printing loop counter is [COLOR="Red"]j[/COLOR], but you print x[[COLOR="Red"]i[/COLOR]]. | |
Re: I don't think the link time solution is simple (if possible at all, depending of your build process). On the other hand, adding [CODE]static inline CREATE_SAMPLING_PORT() { STUB_CREATE_SAMPLING_PORT() }[/CODE] to your a.c will do what you want. | |
Re: I am afraid you are out of luck. w3 [URL="http://www.w3.org/TR/2006/REC-xml-20060816/#sec-comments"]asserts[/URL] that [B]the string "--" (double-hyphen) MUST NOT occur within comments[/B]. | |
Re: [QUOTE=Kruptein;1067377]I'm fetching a list with all files/folders on a ftp-server, I want to put a [F] before a folder, and leave files like they are, but I can't find a way to check if it's a file or a dir... I already tried: [code=python]from ftplib import FTP import os ftp … | |
Re: The string returned by asctime contains an embedded colons and a newline, which are forbidden in Windows filenames. | |
Re: [QUOTE]But isn't it true that, since the post-increment operator has a higher priority than = , i++ will be evaluated first, but the unincremented value of i will be passed to i[/QUOTE] This is true [QUOTE]and i should remain unchanged after all that[/QUOTE] while this is not. An assignment operator … | |
Re: [B]> gcc.exe "D:\Documents and Settings\Riikard\Desktop\Untitled1.c"[/B] You are trying to compile a C++ code, yet tell the compiler that it is C. Rename your sources to .cpp | |
Re: Something is wrong here, don't you think? [CODE]print "test_string:\t%.4f" % timeMethod([B]test_string[/B], 10, 1000000) print "test_stringIO:\t%.4f" % timeMethod([B]test_string[/B], 10, 1000000) print "test_cStringIO:\t%.4f" % timeMethod([B]test_string[/B], 10, 1000000)[/CODE] | |
Re: [B]> inside the routine double *interp( const int length, const int agent )[/B] That is correct, but you never call this routine. It is just sitting idle as good as a dummy. [CODE]interp_coeff = interp(..., ...);[/CODE] will do. | |
Re: [B]> But I can force it to work [/B] Please elaborate. | |
Re: One problem with this code is that it can't match a literal '?'. Another is its complexity. I can't even try to understand how it works, let alone debug it. This is how I would approach globbing: [CODE]#include "glob.h" int globMatch(char * pattern, char * text) { while(*pattern && *text) … | |
![]() | Re: Before going into windchill, try the experiment, you'd be surprised: [CODE] tC = f2c(t); tF = c2f(tC); cout << "t = " << t << "; tF = " << tF << endl;[/CODE] The printed out values should be identical. They are not. ![]() |
Re: Yes it is possible, although I'd recommend automation via make and a shell script. For example, add two targets to a makefile: [CODE] simulate: NEW_file simulation command line here NEW_file: binary_file reader command line here[/CODE] ([ICODE]simulate[/ICODE] target should be a default one). If the simulation generates output, you may want … | |
Re: I don't think that sum can help here. You may resort to functional style: [CODE]Stock_Value = functools.reduce(lambda x, y: x + y.getvalue(), stock_table, 0)[/CODE] | |
Re: [B]:~> g++ a1test.cpp ISBNPrefix.cpp ISBN.cpp :~> a.out[/B] I'd recommend: [CODE]:~> g++ -g a1test.cpp ISBNPrefix.cpp ISBN.cpp :~> gdb a.out (gdb) run ... Segmentation fault (gdb) where ...[/CODE] Now you'd know exactly where the segfault happened, print out relevant variables. PS: you are right that it is [ICODE]valid()[/ICODE] which segfaults. | |
Re: Can you provide some test data set (the smaller the better) which exhibits the seg fault? | |
Re: At the target machine, in the .ssh/environment add BASH_ENV=.profile (assuming bash as a default shell and the standard setup). Otherwise, many important variables, such as TERM, LD_LIBRARY_PATH, etc, etc would remain undefined. | |
Re: perror after line 13 can give some useful information. AD: OP tries to open the file for writing; it doesn't matter if the file already exists or not. | |
Re: Using [url]http://www.daniweb.com/forums/forum2.html[/url] as a starting point I can navigate forums at the tolerable level of discomfort. The out-of-style look of the page gives an impression that it is planned for deprecation. So, my first wish is please don't deprecate it. Second, it would be much more comfortable, if its contents … | |
Re: [B]> By logic /2 should mean half of sequence[/B] Only if those halves are identical. What would be a result of [CODE](0, 1, 2, 3) / 2[/CODE] | |
Re: You never set done to True. Your [ICODE]do {} while(!done)[/ICODE] is a nice infinite loop. Of course it runs out of the string limits. | |
Re: How do you build your project? | |
Re: [CODE]receivefunc() { echo $1 }[/CODE] | |
Re: [B]> The file is open[/B] No, it just seem to be open. Your openfile function does open a file, but does not pass it back to main. The main's fp remains uninitialized. | |
Re: Notice [ICODE]parent 1[/ICODE]. Process with pid 1, aka init, besides other things, adopts every orphan. This means that by the time 6215 prints its message, 6214 is already dead. | |
Re: [B]> [ICODE]cat file1 file2 file3 > outputfile[/ICODE] [/B] I think you are missing the point. The script does not just cat files together. It creates another script, which serves as a primitive self-extracting archive. Let's see what happens when you invoke it as [ICODE]./bundle.sh file1 file2>new.sh[/ICODE] As you said, line … | |
Re: [B]> note: previous implicit declaration of ‘findEntry’...LINE 15[/B] The error message means that by the moment the compiler sees the [B][I]use[/I][/B] of the function, it didn't see neither its prototype nor definition. In such situation the compiler must guess how it should be prototyped, and usually it guesses wrong (it … | |
Re: Just a few (very random) comments. 1. io_gets.c calls for [ICODE]#include <errno.h>[/ICODE]. I realize it gets included through one of the headers anyway, but let's be explicit. BTW, why bother with errno at all? In this particular case it doesn't add anything which would help in recovery. Besides, I firmly … | |
Re: [QUOTE=RayvenHawk;1217929]so I know the issue is most likely not the makefile, but I could be wrong on that.[/QUOTE] So can you post a makefile? | |
Re: [QUOTE][CODE]class polygon{ int n; point *points; public: polygon(int n){ point *points=new point[n]; this->n=n; };[/CODE] [/QUOTE] At the line 6 you initialize a [I]local variable[/I] [ICODE]points[/ICODE]. The [I]member[/I] [ICODE]points[/ICODE] remains uninitialized. | |
Re: Post your requirements. Until then, no advice is possible. |
The End.