And don't forget to call usleep() or something similar for a short period of
time if you're not doing anything in the loop except waiting for Ctrl-C. How
short depends on how responsive you want it to be. Otherwise you'll end up
with a loop that's constantly looping going round and round and eating
In , T o n g wrote:
>I need to check for ^C in an endless loop that doesn't do any stdio.
>How can I do that?
>
>Back in DOS days, I used to use kbhit() from CONIO.H, which checks for
>currently available keystrokes. Is there similar things under Linux gcc?
Ctrl+C will generally result in your pro
On Fri, 16 Apr 2010 14:13:36 -0400 (EDT), Boyd Stephen Smith Jr. wrote:
> Stephen Powell wrote:
>> I'm going to be filing a bug report against parted for (a) miscalculating
>> the starting block of the implicit partition on an ldl (Linux Disk Layout)
>> formatted disk on the s390 architecture when
In <1876691691.55741.1271378240260.javamail.r...@md01.wow.synacor.com>,
Stephen Powell wrote:
>I'm going to be filing a bug report against parted for (a) miscalculating
> the starting block of the implicit partition on an ldl (Linux Disk Layout)
> formatted disk on the s390 architecture when the b
On Thu, 15 Apr 2010 21:09:43 -0400 (EDT), Stephen Powell wrote:
> On Thu, 15 Apr 2010 20:43:21 -0400 (EDT), Ron Johnson wrote:
>> On 2010-04-15 19:37, Stephen Powell wrote:
>>>
>>> I'm going to be filing a bug report against parted for (a) miscalculating
>>> the starting block of the implicit part
On Thu, 15 Apr 2010 20:43:21 -0400 (EDT), Ron Johnson wrote:
> On 2010-04-15 19:37, Stephen Powell wrote:
>>
>> I'm going to be filing a bug report against parted for (a) miscalculating
>> the starting block of the implicit partition on an ldl (Linux Disk Layout)
>> formatted disk on the s390 arch
On 2010-04-15 19:37, Stephen Powell wrote:
[snip]
I'm going to be filing a bug report against parted for (a) miscalculating the
starting
block of the implicit partition on an ldl (Linux Disk Layout) formatted disk on
the
s390 architecture when the block size is other than 4096, and (b) no supp
On Thu, 15 Apr 2010 17:39:42 -0400 (EDT), Boyd Stephen Smith Jr. wrote:
> Stephen Powell wrote:
>> In short, I need to
>> (a) declare "cms_label" as a based structure,
>
> (above; trimmmed)
>>
>> (b)
>> declare a pointer variable called "cms_ptr" and associate it with the
>> "cms_label" structure,
On Thursday 15 April 2010 13:56:00 Stephen Powell wrote:
> On Wed, 14 Apr 2010 23:10:55 -0400 (EDT), Boyd Stephen Smith Jr. wrote:
> > On Tuesday 13 April 2010 17:16:03 Stephen Powell wrote:
> >> What I need to do is to have two structures overlay each other; so that
> >> they occupy the same stor
On Wed, 14 Apr 2010 23:10:55 -0400 (EDT), Boyd Stephen Smith Jr. wrote:
> On Tuesday 13 April 2010 17:16:03 Stephen Powell wrote:
>> What I need to do is to have two structures overlay each other; so that
>> they occupy the same storage. To be specific, here is a structure which
>> describes the
On Tuesday 13 April 2010 17:16:03 Stephen Powell wrote:
> What I need to do is to have two structures overlay each other; so that
> they occupy the same storage. To be specific, here is a structure which
> describes the volume label for an OS-formatted disk:
>
> struct __attribute__ ((packed))
On 20100414_123342, Ron Johnson wrote:
> On 2010-04-14 09:31, Paul E Condon wrote:
> [snip]
> >
> >non-obvious --- to the point that there was an open contest with
> >prizes awarded for the most obfuscated example of C code. The prizes
> >went to the code for which the judges were most surprised on
Ron Johnson wrote:
[snip]
http://www1.us.ioccc.org/main.html I guess they got bored looking at
normal production C code...
Sometimes, I find the code there even more impressive:
http://underhanded.xcott.com/
It's even more restricted, and not so pointless. Hiding in plain sight,
beaut
Ron Johnson writes:
> Unions have been in C for at least 20 years; probably since the Early
> Days.
Unions are in the first edition of K&R.
--
John Hasler
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian
On 2010-04-14 09:31, Paul E Condon wrote:
[snip]
non-obvious --- to the point that there was an open contest with
prizes awarded for the most obfuscated example of C code. The prizes
went to the code for which the judges were most surprised on seeing
it run after they read the code and tried to
Stephen Powell wrote:
I realize that this is not a C forum, per se, but this is a Debian-specific
C question. I am trying to add support to the parted utility for CMS-formatted
disks on the s390 architecture. The source code is written in C, of course.
But I am not a C programmer. I can spell
On 20100413_193540, Robert Baron wrote:
> What a great little learning project.
>
> My suggestion is to work out a simpler version of what you are trying to do:
>
> typedef struct {
> unsigned short rec_type;
> long data;
> } type1;
>
> typedef struct {
> unsigned short rec_type;
>
What a great little learning project.
My suggestion is to work out a simpler version of what you are trying to do:
typedef struct {
unsigned short rec_type;
long data;
} type1;
typedef struct {
unsigned short rec_type;
char data[4];
} type2;
.
some_type *chunk_of_mem;
long
> Tue, 13 Apr 2010 17:29:51 -0500 wrote:
>
> On 2010-04-13 17:16, Stephen Powell wrote:
> > I realize that this is not a C forum, per se, but this is a Debian-specific
> > C question. I am trying to add support to the parted utility for
> > CMS-formatted
> [snip]
> >
> > I know how to do this
On 2010-04-13 17:16, Stephen Powell wrote:
I realize that this is not a C forum, per se, but this is a Debian-specific
C question. I am trying to add support to the parted utility for CMS-formatted
[snip]
I know how to do this in PL/I, but despite having spent the last two hours
paging throug
Mark Allums <[EMAIL PROTECTED]>:
> Mark Allums wrote:
> > Rich Healey wrote:
> > > Mark Allums wrote:
> > >> 1. You might want to learn PERL or Python or Ruby, and do it there.
> > > FWIW, this is very easy to do in Python.
> > > PSFWIW: Satan uses Ruby.
> >
> > I thought that Beelzebub
Mark Allums wrote:
> Rich Healey wrote:
> > Mark Allums wrote:
> >> 1. You might want to learn PERL or Python or Ruby, and do it there.
> > FWIW, this is very easy to do in Python.
> > PSFWIW: Satan uses Ruby.
>
> :)
>
> I thought that Beelzebub used IronPython.
>
I mean, given the connection
Rich Healey wrote:
> Mark Allums wrote:
>> 1. You might want to learn PERL or Python or Ruby, and do it there.
> FWIW, this is very easy to do in Python.
> PSFWIW: Satan uses Ruby.
:)
I thought that Beelzebub used IronPython.
--
Mark Allums
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Mark Allums wrote:
> H.S. wrote:
>> Hello,
>>
>> In a C++ program I am reading a data file for later processing and
>> computations. While reading that data file, I want to keep track of
>> data items (doubles) read.
>>
>> The data file is just a text
Mark Allums wrote:
Not directly helpful, but some suggestions:
1. You might want to learn PERL or Python or Ruby, and do it there.
hmm .. not sure how this will pan out in the long run, but for now, I am
trying to keep it all within one program.
2. If it has to be C++, learn enough PERL t
On Tuesday 06 May 2008, H.S. wrote:
> Ron Johnson wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > On 05/06/08 11:42, H.S. wrote:
> >> Hello,
> >>
> >> In a C++ program I am reading a data file for later processing and
> >> computations. While reading that data file, I want to k
H.S. wrote:
Hello,
In a C++ program I am reading a data file for later processing and
computations. While reading that data file, I want to keep track of data
items (doubles) read.
The data file is just a text file with N lines with C doubles in each
line (N and C are known a priori). For n
On 06/05/2008, H.S. <[EMAIL PROTECTED]> wrote:
> In a C++ program I am reading a data file for later processing and
> computations. While reading that data file, I want to keep track of data
> items (doubles) read.
Use std::list and other standard data structures.
It's C++. Don't use C arrays, ug
On Tue, May 6, 2008 at 12:57 PM, Ron Johnson <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 05/06/08 11:42, H.S. wrote:
> > Hello,
> >
> > In a C++ program I am reading a data file for later processing and
> > computations. While reading that data file, I want
Ron Johnson wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 05/06/08 11:42, H.S. wrote:
Hello,
In a C++ program I am reading a data file for later processing and
computations. While reading that data file, I want to keep track of data
items (doubles) read.
The data file is just a text
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 05/06/08 11:42, H.S. wrote:
> Hello,
>
> In a C++ program I am reading a data file for later processing and
> computations. While reading that data file, I want to keep track of data
> items (doubles) read.
>
> The data file is just a text file wi
On Wed, 10 Aug 2005 08:36:54 +0700
Ms Linuz <[EMAIL PROTECTED]> wrote:
> Wackojacko wrote:
>
> >> Sorry, another lazy googling day ...
> >> Anybody got links or hardcopy of some kind like C/C++ programming
> >> reference on linux ?
> >> Thanks a lot.
> >>
> >> --w.h--
> >>
> > I found 'Teach Your
Wackojacko wrote:
>> Sorry, another lazy googling day ...
>> Anybody got links or hardcopy of some kind like C/C++ programming
>> reference on linux ?
>> Thanks a lot.
>>
>> --w.h--
>>
> I found 'Teach Yourself C++ in 21 Days' quite useful having not
> programmed in C, or any other language for th
Sorry, another lazy googling day ...
Anybody got links or hardcopy of some kind like C/C++ programming
reference on linux ?
Thanks a lot.
--w.h--
I found 'Teach Yourself C++ in 21 Days' quite useful having not programmed
in C, or any other language for that matter, before. Available at
http:/
> On 8/9/05, Ms Linuz <[EMAIL PROTECTED]> wrote:
> > Sorry, another lazy googling day ...
> > Anybody got links or hardcopy of some kind like C/C++ programming
> > reference on linux ?
> > Thanks a lot.
> >
The GNU C Library Manual:
http://www.gnu.org/software/libc/manual/
cheers,
Christian
Bruce Eckel's Thinking in C++ Vol. 1 & 2.
I love that book.
On 8/9/05, Ms Linuz <[EMAIL PROTECTED]> wrote:
> Sorry, another lazy googling day ...
> Anybody got links or hardcopy of some kind like C/C++ programming
> reference on linux ?
> Thanks a lot.
>
> --w.h--
>
>
> --
> To UNSUBSCRIBE, ema
Hi!
On Wed Jun 18, 2003 at 02:49:26PM +0200, Sebastian Kapfer wrote:
> On Tue, 17 Jun 2003 23:30:15 +0200, Thomas Krennwallner wrote:
> > This code snippet will lookup the PATH environment and search for the
> > "ps" executable. It will execute it and will pass "ps" as argv[0] and
> > "x" as argv[
On Tue, 17 Jun 2003 23:30:15 +0200, Thomas Krennwallner wrote:
> This code snippet will lookup the PATH environment and search for the
> "ps" executable. It will execute it and will pass "ps" as argv[0] and
> "x" as argv[1]. It is equivalent to:
>
> $ ps x
Don't you mean
$ exec ps x
--
Bes
As others have said 'exec' refers to the family of exec system calls. It
is part of POSIX 1003.
rgh
On Wed, 2003-06-18 at 05:29, Shaul Karl wrote:
> I was told that similar to execl, execlp et al there is also an exec
> call. Yet when I run
>
> man exec
>
> I only get execl, execlp, exec
On Tue, Jun 17, 2003 at 10:29:25PM +0300, Shaul Karl wrote:
> I was told that similar to execl, execlp et al there is also an exec
> call. Yet when I run
>
> man exec
>
> I only get execl, execlp, execle, execv and execvp. No `pure' exec, one
> without any additional letters. Can I safely
Thus spake Shaul Karl:
> I was told that similar to execl, execlp et al there is also an exec
> call. Yet when I run
>
> man exec
>
> I only get execl, execlp, execle, execv and execvp. No `pure' exec, one
> without any additional letters. Can I safely tell that person that he is
> definit
Hi!
On Tue Jun 17, 2003 at 10:29:25PM +0300, Shaul Karl wrote:
> I was told that similar to execl, execlp et al there is also an exec
> call. Yet when I run
>
> man exec
This is exec(3) which documents the exec family calls. AFAIK there is no
POSIX exec() function. Please install the glib
Petre Daniel <[EMAIL PROTECTED]> wrote:
>
> Where should i read about C programming under linux?
> I need urls with download guides..
>
http://www.advancedlinuxprogramming.com
This book is published under the Open Publication License, you can get
the full text in the download section.
- Arno.
> Where should i read about C programming under linux?
> I need urls with download guides..
>
> Petre L. Daniel,System Administrator
> Canad Systems Pitesti Romania,
> http://www.cyber.ro, email:[EMAIL PROTECTED]
> Tel:+4048220044, +4048206200
>
An ANSI C program is the same with any platform t
Richard Cobbe writes:
> heap. Unfortunately, this may or may not be the location of the root
> error. While I'm a big fan of garbage collectors in general, I don't think
You can always hope that it's a piece of memory you were dealing with
before. Depending on the malloc debugger, you may als
Lo, on Thursday, July 26, Shaul Karl did write:
> Program received signal SIGSEGV, Segmentation fault.
> 0x400af19e in malloc () from /lib/libc.so.6
> (gdb)
>
>
> How can it be? If malloc can not allocate memory it should return a NULL
> pointer. How can it Seg fault?
As Andrew Agno and Alan
>
> Try breaking the mallocs into separate lines to see which one fails:
>
> int errflag = 0;
> if (!(node = (struct node *)malloc(sizeof(struct node {
> errflag = 1;
> } else {
> if (!(node->data = (struct symbol *)malloc(sizeof(struct
> symbol {
>
Shaul Karl <[EMAIL PROTECTED]> writes:
> How can it be? If malloc can not allocate memory it should return a NULL
> pointer. How can it Seg fault?
You have most likely overwritten the end of an array and overwritten
malloc's accounting info, causing a segfault next time you malloc
something.
--
>
>
> On Thu, 26 Jul 2001, Shaul Karl wrote:
>
> > How can it be? If malloc can not allocate memory it should return a NULL
> > pointer. How can it Seg fault?
>
> The internal state of the stack became corrupted. Try compiling with
> "-lefence" (electric fence). Then reproduce the error. It wi
* Shaul Karl ([EMAIL PROTECTED]) spake thusly:
...
> 193 enum flag insert_symbol(struct symbol *sym)
> 194 {
> 195 struct node *node;
> 196
> 197 if (!((node = (struct node *)malloc(sizeof(struct node))) &&
> 198 (node->data = (struct symbol *)malloc(sizeof(s
Try breaking the mallocs into separate lines to see which one fails:
int errflag = 0;
if (!(node = (struct node *)malloc(sizeof(struct node {
errflag = 1;
} else {
if (!(node->data = (struct symbol *)malloc(sizeof(struct
symbol {
errflag =
> Have you tried to look at the value sizeof(struct node)? It might be too big.
> Otherwise, can you show us the backtrace in gdb.
>
gdb says sizeof(struct node) == 20. It is mostly a couple of pointers:
struct node {
enum colors color;
struct node *left, *right, *parent;
Have you tried to look at the value sizeof(struct node)? It might be too big.
Otherwise, can you show us the backtrace in gdb.
On [Thu, 26 Jul 2001 03:15:46 +0300], Shaul Karl <[EMAIL PROTECTED]> wrote:
> Breakpoint 2, insert_symbol (sym=0xbfffe25c) at symbols.c:197
> 197 if (!((node = (st
[EMAIL PROTECTED] wrote:
What does the construct
_("What ever format string I use")
means in the context of printf?
For example:
[00:50:20 tmp]$ grep -C1 printf\(_\( util-linux-2.11b/misc-utils/script.c
if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version")) {
[EMAIL PROTECTED] writes:
> What does the construct
>
>_("What ever format string I use")
>
> means in the context of printf?
This construct is often used for 'gettext'. gettext translates text
messages.
>From gettext's info page:
Many packages use `_' (a simple underline) as a keyword
Hi,
With your program, if you print out some values of x and y, you
can see that y become very very small after a couple of
iterations.
When y is too small, the following statement become true:
z = x+y, z == x because y is too small and is ignored due to th
On Sat, Aug 05, 2000 at 11:31:02AM -0500, Philip C Mendelsohn wrote:
> On Fri, 4 Aug 2000, Eric G . Miller wrote:
>
> > I suggest going to comp.lang.c and checking the C FAQ. Specifically look
> > for the inherent problem of putting the same variable on both sides of a
> > relational operator: (x+
On Fri, 4 Aug 2000, Eric G . Miller wrote:
> I suggest going to comp.lang.c and checking the C FAQ. Specifically look
> for the inherent problem of putting the same variable on both sides of a
> relational operator: (x+y) > x
In this case, a little algebra shows that all you need to check is y >
To follow up: how floating point numbers are represented in the machine
during computations may vary slightly from how they get represented when
stored into a variable. That is, the evaluation of (x+y) may have
greater numerical precision then the result of z = x + y. In the second
case, there "a
I suggest going to comp.lang.c and checking the C FAQ. Specifically look
for the inherent problem of putting the same variable on both sides of a
relational operator: (x+y) > x
If memory serves, the behavior is "undefined" -- so don't do it!
On Fri, Aug 04, 2000 at 11:55:36PM +0200, Christophe TR
On Fri, 4 Aug 2000, John Reinke <[EMAIL PROTECTED]> wrote:
>
> 1) This is NOT for a programming assignment. ;-)
Ho, no! :-) These are just some experiments.
> 2) Using the comma within a condition is treated as AND (&&). That's
> messier code than I usually create.
Well, this is uncorrect. E
On 04-Aug-2000 Christophe TROESTLER wrote:
> Hi the list,
>
> I apologize if that is a little bit off topic but I am a bit puzzled
> and I know there are experts on this list. I would like an
> explanation on why the two "for" below give different results.
>
my comment here is -- use
Quick answer here - I'll make two assumptions:
1) This is NOT for a programming assignment. ;-)
2) Using the comma within a condition is treated as AND (&&). That's
messier code than I usually create.
Making the z = x + y assignment is part of the loop's condition, so it is
evaluated at whatever
Fix below:
Keith wrote:
> I am trying to fumble through learning how to do some C programming.
> In the book I am using, Beginning Linux Programming they are now trying
> to use ncurses. I am getting the following errors when I try to compile
> my source. I am compiling with this command:
>
> $ c
64 matches
Mail list logo