636 Posted Topics

Member Avatar for CleanSanchez

Your Deal function is very very wrong. It may cause all sorts of problems (including the one you observe).

Member Avatar for CleanSanchez
0
150
Member Avatar for Jamesbch

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 …

Member Avatar for ole.tange
0
347
Member Avatar for jrw89

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 …

Member Avatar for gerard4143
0
147
Member Avatar for Dark2Bright

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]

Member Avatar for Dark2Bright
0
70
Member Avatar for myk45

[B]> step around the compiler protection...[/B] ... straight into the undefined behaviour.

Member Avatar for gerard4143
0
88
Member Avatar for 1bh

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

Member Avatar for abhimanipal
0
242
Member Avatar for titan5

Are you trying to [I]execute[/I] the makefile? What about just typing [icode]make[/icode] at the command prompt?

Member Avatar for titan5
0
208
Member Avatar for phil750

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

Member Avatar for C++ThugLife
0
282
Member Avatar for Sirovica

Some numbers are both multiple of 3 AND a multiple of 5. You count such numbers twice.

Member Avatar for frogboy77
0
149
Member Avatar for sundip

A separate dll is not necessary. dlopen(0, ...) gives a handle to the main module.

Member Avatar for sundip
0
259
Member Avatar for Auraomega

I see that the thread is solved. However, using __DATE__ and __TIME__ (which are stanadrd predefined macros) looks more straightforward...

Member Avatar for nezachem
0
133
Member Avatar for arnas

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 …

Member Avatar for arnas
0
233
Member Avatar for Jishnu

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

Member Avatar for Jishnu
1
594
Member Avatar for bnickerson

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

Member Avatar for bnickerson
0
2K
Member Avatar for bnickerson

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

Member Avatar for nezachem
0
370
Member Avatar for rahul8590

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.

Member Avatar for kings_mitra
0
116
Member Avatar for Jamesbch
Member Avatar for daviddoria
Member Avatar for mike_2000_17
0
219
Member Avatar for MarounMaroun

Your printing loop counter is [COLOR="Red"]j[/COLOR], but you print x[[COLOR="Red"]i[/COLOR]].

Member Avatar for MarounMaroun
0
1K
Member Avatar for XtremeCold

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.

Member Avatar for XtremeCold
0
233
Member Avatar for PythonNewbie2

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

Member Avatar for snippsat
0
2K
Member Avatar for Kruptein

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

Member Avatar for Sunjay03
0
7K
Member Avatar for jbronen

The string returned by asctime contains an embedded colons and a newline, which are forbidden in Windows filenames.

Member Avatar for jbronen
0
828
Member Avatar for daudiam

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

Member Avatar for daudiam
0
241
Member Avatar for Galdzor

[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

Member Avatar for nbaztec
0
110
Member Avatar for dansnyderECE
Member Avatar for shavais

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]

Member Avatar for snippsat
0
121
Member Avatar for parisa_bala

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

Member Avatar for Banfa
0
174
Member Avatar for mick3339
Member Avatar for gusano79
0
719
Member Avatar for NathanOliver

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

Member Avatar for NathanOliver
4
488
Member Avatar for Griff0527

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.

Member Avatar for Griff0527
0
2K
Member Avatar for dansnyderECE

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 …

Member Avatar for dansnyderECE
0
119
Member Avatar for i-teq

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]

Member Avatar for i-teq
0
4K
Member Avatar for pickler

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

Member Avatar for pickler
0
179
Member Avatar for dansnyderECE

Can you provide some test data set (the smaller the better) which exhibits the seg fault?

Member Avatar for dansnyderECE
0
384
Member Avatar for bgk111

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.

Member Avatar for bgk111
0
241
Member Avatar for tomtetlaw

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.

Member Avatar for tomtetlaw
0
2K
Member Avatar for Narue

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 …

Member Avatar for ~s.o.s~
2
856
Member Avatar for TrustyTony

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

Member Avatar for TrustyTony
0
338
Member Avatar for RayvenHawk

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.

Member Avatar for RayvenHawk
0
199
Member Avatar for Dows
Member Avatar for laserlars
Member Avatar for Alerwiali

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

Member Avatar for abhimanipal
-1
166
Member Avatar for MrDiaz

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.

Member Avatar for MrDiaz
0
107
Member Avatar for rohit_static

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

Member Avatar for nezachem
0
193
Member Avatar for Wizablue

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

Member Avatar for Wizablue
0
360
Member Avatar for Narue

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 …

Member Avatar for Narue
3
378
Member Avatar for RayvenHawk

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

Member Avatar for RayvenHawk
0
182
Member Avatar for blahbla

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

Member Avatar for blahbla
0
75
Member Avatar for llemes4011
Member Avatar for llemes4011
0
117

The End.