comp.lang.c
http://groups-beta.google.com/group/comp.lang.cToday's most active topics: * C 99 compiler access - 118 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6ab6fa86dd3e2204 * +++i - 40 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3d42b0520ce505c0 * How does free() knows? - 40 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/88c4b65202d808c5 * malloc and free - 25 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9dc6bf671c014afb * define a data type of 1 bit size - 22 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/586b37c8227a9ded Active Topics ============= C 99 compiler access - 118 new ---------------------------------- - Fri, Sep 3 2004 12:12 am 118 messages, 27 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6ab6fa86dd3e2204 some C puzzles - 5 new ---------------------------------- - Fri, Sep 3 2004 12:13 am 5 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cafd16a087da5edc [OT, welcom msg] Usage of VxWorks setsockopt() - 3 new ---------------------------------- - Fri, Sep 3 2004 12:52 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f4374b99f3962335 critique: conversion to binary - 10 new ---------------------------------- - Fri, Sep 3 2004 1:12 am 10 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/732890bf43c4f412 Max Size of argv[1] ??? - 3 new ---------------------------------- ... Well excuse me for giving a real world answer. ... - Fri, Sep 3 2004 1:50 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/1342c9a4e904919b integer array - all new ---------------------------------- ... So you never get any word alignment problems with arrays? ... - Fri, Sep 3 2004 2:02 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cdb9ee27610c48f5 free() is useless... - 17 new ---------------------------------- ... Agreed. But when I use EXIT_SUCCESS, I don't know if that will return a 0 or not. ... - Fri, Sep 3 2004 2:32 am 17 messages, 11 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/60f72b526ebc13a4 How does free() knows? - 40 new ---------------------------------- ... Yes, I am serious in my statement. Doesn't malloc() return a void pointer which can't be used until cast to something "real"? Or are we assuming implicit casting is better than explict casting? Why? Post a link to the FAQ and I'll read it. You might think about that when you tell someone to read it. Duh. "errata page for K&R2"?? That doesn't parse. ;-) Tough crowd. These are the jokes folks... ... - Fri, Sep 3 2004 3:15 am 40 messages, 26 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/88c4b65202d808c5 exit() - 8 new ---------------------------------- if the exit() function is contained in stdlid.h why if i remove the above header file the exit function still works and i can still compile program without any error messages using cc file.c if i use cc -Wall file.c i get error message file.c:18: warning: implicit declaration of function `exit' but program will still run and function properly ... - Fri, Sep 3 2004 3:45 am 8 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6e130b58a7b9c32e Removing white spaces and tab characters - 12 new ---------------------------------- Hi, I have a text like this - "This is a message containing tabs and white spaces" Now this text contains tabs and white spaces. I want remove the tabs and white spaces(if it more than once between two words). Is there any function we have in C which will find out the tabs and white spaces and returns the text in the follwong way - "This is a message containing tabs and white spaces" Any code help is welcome.. Awaiting the response Gopal Srinivasan ... - Fri, Sep 3 2004 5:06 am 12 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4a27aad23147a890 generalised linked list routines - opinion appreciated - 7 new ---------------------------------- Hi, I've knocked up a number of small routines to create and manipulate a linked list of any structure. If anyone could take a look at this code and give me their opinion and details of any potential pitfalls I'd be extremely grateful. Cheers Steve ll.h /* USAGE NOTES FOR CALLING MODULES -- include the linked list module header file ... -- declare any structure that is going to make up the linked list eg. struct PERSONAL_DETAILS { char forename[20]; char surname[20]; short house_number; char street[20]; char town[20];.. . - Fri, Sep 3 2004 5:11 am 7 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/dca126d9920c6c3b addresses and integers - 13 new ---------------------------------- ... No. This is why I wrote "as portable as reasonably possible" above. ... They are not maximally portable, but they work on the pointer model used by practically all byte-addressed systems with a linear address space, only "fat " pointers could break them, but "fat" pointers are not exactly the kind of feature the average programmer will ever see during his entire career. Dan... - Fri, Sep 3 2004 5:18 am 13 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/bd05167f104cfcf9 Anonymous Union Member Access - all new ---------------------------------- ... You'll need a cast, but otherwise it looks alright. All union members are guaranteed to start at offset zero. struct circle *c = (struct circle *) &s.u; ... - Fri, Sep 3 2004 5:59 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b4dd29d189a73b70 Array size limits - 10 new ---------------------------------- ... I've also used xnews quite a bit which also makes it irrelevant whether the replies are top or bottom-posted. Top-posted text will be visible first and it automatically skips quoted text (as an option). The google comment could be change to 'use a decent threaded newsreader' and it still wouldn't matter how someone chooses to reply (assuming you thread the articles and read them as a group if you want to get proper context). ... - Fri, Sep 3 2004 6:00 am 10 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/92972b7769666961 C Book from comp.lang.c !!! - 22 new ---------------------------------- ... Thank you . Will go and look for it in Ebay ... - Fri, Sep 3 2004 6: 30 am 22 messages, 13 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fbc592595aa5bb1d Bloodshed Dev. Compiler will only not show me my RUN execuable. Help! - 13 new ---------------------------------- Sorry I am new to C programming & this newsgroup. But I downloaded a C compiler & when it runs the executable file it pops up the dos prompt & shows my executed file but only for a nanosecond & then flips off. I cant see my executed file. I can go to the MSDOS prompt & run it but thats a pain. There's got to be some place to click where you can look at it until you press a key or something. HElp ... - Fri, Sep 3 2004 6:30 am 13 messages, 9 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/39090a2f7b27659e string length questions related to fseek - 10 new ---------------------------------- sieg1974 said to us: ... When you read using fgets, the line ends with a "\n\ 0" sequence (on un*x) or "\r\n\0" (on Windows). If you're on unix, and you read 255 data characters, the terminating chars of "\n\0" will take you up to 257 characters required to store all the data. ... - Fri, Sep 3 2004 6: 56 am 10 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4bdc1307381158 Some bit manipulation - 3 new ---------------------------------- ... ... And isn't this exactly what I was doing? ... I was trying to be as explicit as possible (the OP was obviously a newbie in the field) rather than as terse as possible. So, I've chosen a way that implemented the OP's specifications in the very order they were formulated and in a manner that was the easiest (IMHO) to follow. Otherwise, I would have simply written: R = ~A & B; and let the OP not much more enlightened than he was before posting. Dan... - Fri, Sep 3 2004 7:20 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/42f56779fd8786a1 stripping newline from input - 4 new ---------------------------------- ... In my, admitedly, limited experience, Windows implementations return \n when encountering a \n character in the input file. The missing \r doesn't make any difference. Dan... - Fri, Sep 3 2004 7:40 am 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8394c8873211d7b9 Two Questions about "strlen", "strcat" and "strcpy" - 9 new ---------------------------------- ... If you manage to convince him that they are bugs... Dan... - Fri, Sep 3 2004 7:42 am 9 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e9ba0a3a9129c3ba array of functions - 6 new ---------------------------------- Can anyone tell me if I can have an array of functions that take a variable number of parameters? If it is possible I'd like to know how to declare the array and the functions as its elements. I am looking for something like this: array[] = {func1(a, b, c), func2(b, c), func3(a), func4(a,b,c,d)....} If I need to call a function I want to be able to call the function by writing something like array[3] Is that or anything close to that format possible? .. . - Fri, Sep 3 2004 8:41 am 6 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7676825fcece55e8 webpage bookmark program in C - 2 new ---------------------------------- ... Many people feel designing your program before you begin to write it is a good idea. ... Note that the C language does not include a GUI. There are many GUI APIs which can be used from C, but you'll have to go elsewhere for advice on that. (I recommend figuring out on what platform your program will be implemented, then asking in the group for that platform; they should be able to offer recommendations. Many GUI APIs have their own groups as well.) . .. This is a platform-specific question - the C language says nothing... - Fri, Sep 3 2004 8:21 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/503514d618f5844a Develping a good scheduler for ARINC transmission... advice needed - 3 new ---------------------------------- The scheduler in this case is geared for arinc, but I was looking for information on creating a scheduler just in general. What newsgroup would be appropriate for asking a question regarding creating a flexible scheduler? Mark ...... - Fri, Sep 3 2004 9:16 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f94f207ee9ae105e glibc: socket and fdopen - 6 new ---------------------------------- I am playing around with sockets and have the following problem. I have the socket newsock created by accept(). This code: FILE *clstream = fdopen ( newsock, "rw" ); fputs ( "message\n", clstream ); fflush ( clstream ); does NOT send anything to the telnet client at the other end. Why? (gcc 3.3.3, glibc 2.3.3) Thomas Jollans ... - Fri, Sep 3 2004 9:41 am 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/846e1057eb3887d3 Printing source code - 5 new ---------------------------------- ... The classic Unix program for this sort of thing, I think, is vgrind, from BSD 3.0. I suspect some of the other options people have suggested offer more features, though. ... - Fri, Sep 3 2004 9:22 am 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/48f47a11c885cf8e How to create folder at fopen? - all new ---------------------------------- ... I don't know whether the backslash has prior use outside of computing, but its introduction to computing is generally credited to Bob Bemer, "The Father of ASCII", who died recently. I've read that he introduced it so that the logical "and" and "or" (disjunction and conjunction) could be written as "/ \" and "\/". ... - Fri, Sep 3 2004 10:02 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/add061f2e47236a8 Why va_start takes 2 arguments - 3 new ---------------------------------- I was just checking and http://www-ccs.ucsd.edu/c/stdarg.html I seemed to have never given this simple thing much thought, but I was just curious of the reason why this might be the case so I checked up the Rationale at And it seems to have confused me more than before. Can anyone provide any insight into what sort of implementations might find the second argument intresting? And what is this thing about registers and function pointers. Thanks. ... - Fri, Sep 3 2004 11:19 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4f399a20ff8c104d malloc->free->damage: after normal block - all new ---------------------------------- ... Not an error, though... See the other replys for that. -- Thomas ... - Fri, Sep 3 2004 12:39 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cf3764e1087d5544 Labeling Jagged Arrays - all new ---------------------------------- I have multi-dimesional arrays that can be specifed by the user, e.g 1,2,3,4, 5 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6 I think a bit of code that will iterate over these arrays to print out the element indices for each unique element in the N-dimensional array. E.g. for the above 1:1:1 1:1:2 1:1:3 1:1:4 So what is the loop with the printf that will print the line to std??? This is probably simple as hell but its late and I can't think!! ... - Fri, Sep 3 2004 1:46 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e42439b1812fb147 Post length for code. - 21 new ---------------------------------- One imagines that code over a certain length should be put on a website and the URL posted here. However, one also imagines that some readers will not have a web browswer available; posting a URL only will not serve such readers. My wee program is approaching 200 lines. Is that too long to post here? Thanks for reading.... - Fri, Sep 3 2004 2:00 pm 21 messages, 11 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a6e755232874d6b5 Bit Pattern Problem - 21 new ---------------------------------- ... a is uninitialized. You cannot pass it to a function in this state, even if the function will not attempt to evaluate it. This invokes undefined behavior. In this case, you probably don't want to pass it at all anyway. snip <<Remove the del for email>> ... - Fri, Sep 3 2004 4:07 pm 21 messages, 12 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/78ecd2d1af0b023e Shortcircuitting with -Inf float value. - all new ---------------------------------- On Thu, 02 Sep 2004 02:08:37 -0400, Martin Ambuhl ... K&R says errno will be EDOM and the return value is implementation defined. <<Remove the del for email>> ... - Fri, Sep 3 2004 4:07 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/37546f2a8a5cb0bc small C puzzles - all new ---------------------------------- In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says. .. ... I no longer have the thread in my newsreader, but it referred specifically to the lack of '\n' or fflush(stdout) in the code, IIRC. ... - Fri, Sep 3 2004 5:03 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9ef94b909fc090e8 Pointer conversion - 4 new ---------------------------------- Hello. I have this program that I copied out of a textbook. I can't seem to get it to work. It's a rather old book, that seems to be using old K&R C. I fixed up to be more standardized, but I still get a "nonportable pointer conversion in function initialize" error. I looked at the initialize function, but it seemed ok. So then I checked the caller, but that looked ok too... I am rather new at C programming and pointers (and arrays and..... etc) . /* Convert English into Piglatin */ ... /* Function Prototypes */... - Fri, Sep 3 2004 6:36 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a42ff701af696273 Object Oriented Programming in C, Avoid Memory Allocation - 10 new ---------------------------------- Dear all, I am trying to write a piece of software that use Object Oriented design and implement it with C, I did the following == In Object.h == typedef struct ObjectStructure* Object; Object object_create(); int object_ getIntegerAttribute(Object object); void object_setIntegerAttribute(Object object, int integerAttribute); void object_unload(Object object); == In Object.c == ... struct ObjectStructure { int integerAttribute; ... Object object_create() {return (Object)malloc(sizeof(struct ObjectStructure));}... - Fri, Sep 3 2004 7:41 pm 10 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/32627a93730597ec Heathfield - 2 new ---------------------------------- Ich nutze zum ersten Mal Nachrichtengrupen. Ist Richard Heathfield gelegentlich noch da? MPJ ... - Fri, Sep 3 2004 9:03 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d878b61f04670a1a Dynamic loop nesting - all new ---------------------------------- ... Un paio di volte ho risolto utilizzando un sistema simile di for(;;). Dove l'hai preso questo pezzo di codice? ... - Sat, Sep 4 2004 1:08 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8f838db3ecfa06e8 Puzzle - 3 new ---------------------------------- What is the difference between the following declarations? void funct(); void funct(void); I guess there is definitely a difference between them. ... - Sat, Sep 4 2004 3:42 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ba3fbba3620feb6a >From where i can download C9X compiler for both linux and windows - 2 new ---------------------------------- I want to download C9X c coplier for both linux as well as windows. From which site i can get it. Will the C9X compiler be same for both LINUX SUSE and RED HAT LINUX 9.0 or different. Amit ... - Sat, Sep 4 2004 7:52 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8606c8f1383b0047 Fix your FAQ - 8 new ---------------------------------- I came across in clc++ this by chance: "There is no language construct for dynamically allocating multidimensional arrays. See the comp.lang.c FAQ question 6.16 and related questions: (Substitute new for malloc appropriately)... - Sat, Sep 4 2004 9:34 am 8 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fa04d42375f04cbf Determining EOF using fseek()? - 4 new ---------------------------------- In article <news:[EMAIL PROTECTED]> ... This is not a good idea. ... a file named "test.txt" with "rb" -- binary -- mode.] .. . The second method could loop forever if run on an input file that is (e.g.) on a bad floppy disk. (Remember floppies? :-) ) Suppose fgetc() attempts to read a sector off the floppy, but the sector is bad. The read will fail, but * not* because of end-of-file. The C standard then suggests that feof(Fp) should return 0, and ferror(Fp) should return some nonzero value. ... - Sat, Sep 4 2004 10:24 am 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8a2feab451c13f24 comp.lang.c Answers to Frequently Asked Questions (FAQ List) - 4 new ---------------------------------- ... Check back in the clc archives. Steve posted a diff when he made the updates.... - Sat, Sep 4 2004 1:42 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/1d05e73841295d46 Need help on bit operations define - 6 new ---------------------------------- ... Since the purpose of SetBits is bit manipulation, ">> 3" and "& 7" are actually clearer than "/ 8" and "% 8", in my opinion. ... C99 doesn't allow implicit int (and you're not returning an int anyway). The above should be: inline void SetBits( ... [...] ... - Sat, Sep 4 2004 1:42 pm 6 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7b491449ae29143d qsort(...) in <stdlib.h> - 6 new ---------------------------------- can someone tell me how qsort function in is used (qsort(..........))? the function has a buffer, two void * parameters and the a pointer to a compare function. Thanks. ... - Sat, Sep 4 2004 3:48 pm 6 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/223397d3c163b056 How valid is a "draft"? - 13 new ---------------------------------- Hello! I found on the web (www.open-std.org) what I think are C standard drafts for C99 and C89. I suppose it is legal to download since tere is no message forbiding (sorry for my terrible english :) to download or requesting payment. WG14/N843 Committee Draft -- August 3, 1998 Committee Draft -- January 18, 1999 WG14/N869 Those are the file's headers, so I deduced they're drafts of C98 and C99 ... Are those 'drafts' as valid as the real standard? If they are, why must we pay for a standard as valid as a "free"... - Sat, Sep 4 2004 6:24 pm 13 messages, 9 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4942020acd809413 nested function support - 11 new ---------------------------------- does anyone know if the ms c compiler has nested function support, I have a large gcc project I need to merge into another ms c program. Thanks in advance. ... - Sat, Sep 4 2004 9:43 pm 11 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/48ef8e99db68b682 How to convert int to char * ? - 5 new ---------------------------------- how to convert int to char * ? I have found this in a web site. However, it doesn't work even I change itoa to atoi including stdlib.h char str[10]; int i=567; str=itoa(i, str, 10); ... - Sat, Sep 4 2004 9:32 pm 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4ef1fbbea91792a0 Segfault question. - 11 new ---------------------------------- When I started testing the algorithms for my wrap program, I threw together this snippet of code, which works quite well. Except that it (predictably) segfaults at the end when it tries to go beyond the file. At some point, I tried to mend that behavior using feof() but without success. The functionality is not harmed, but this has started to bug me. What am I missing here? Sometimes being a code duffer is frustrating!! lol!!! The code: ... int main (int argc, char *argv[]) { ... Thanks for reading.... - Sat, Sep 4 2004 10:57 pm 11 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/17f4d111f9ca7f98 Multi Lang support C functions ? - all new ---------------------------------- Hi, I am writing an application in c. which retrieves information stored in some conf. files The application is a simple network agent. it communicates with a remote network manager. Suppose i have selected russian key board layout and store some conf. in some files. when i view them, i see some spl characters some info which i cant read. some characters which i suppose it is in russian. This is similar when i select french or german keyboard layout. I want to read and write into these files.... - Sun, Sep 5 2004 4:59 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9ec132e2774674e1 Typedef structs - 3 new ---------------------------------- Could someone explain why you need the struct keyword at all when declaring a variable : The code below works ok and I've declared my_struct without using the struct keyword. ... { int a; int b; ... { test_struct my_struct; printf("hello world\n"); ... ... - Sun, Sep 5 2004 6:29 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/341cf36d2ef82b01 linux socket help - 3 new ---------------------------------- As you can tell by my code that I will post I am obviously new with linux socket programming so to be to hard on me :) When I run my little program I get this error: Server: got connection from 192.168.0.5 recv: Transport endpoint is not connected. I don't know what that means or why I am getting it. I know the connection is made by the server: message. My other end program is a VB program. When i uncomment out the appropriate lines in the following code my VB app works just find for receiving messages. Thanks... - Sun, Sep 5 2004 9:12 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f34c0792058777e2 string literals question - 10 new ---------------------------------- I've noticed that it's valid to pass a string literal (like "test") to a function that expects a const char *. Does this mean that in C a string literal is automatically converted to a const char * if I pass it to a function? TIA, copx ... - Sun, Sep 5 2004 9:51 am 10 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/411b5ee4958541d7 strtok & global variables - 3 new ---------------------------------- Hello, I wrote a function called eat_path() to split a string into components e.g. /a/b/c ==> namePtr[0] = a,namePtr[1] = a, namePtr[2] = c // Global variable char *namePtr[100] = {0}; int n; /*number of components*/ The function is like this: void eat_path(char *pathname) { printf("Enter eat_path\ n"); //eat_path() breaks up a pathname into component strings. //Then n=4, namePtr[0] ="this", namePtr[1] ="is", namePtr[2] ="a", //namePtr[3] ="test" / /The component names will be used to search for a child under its... - Sun, Sep 5 2004 4:22 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d30d7cb3e35757e3 Runge kutta Cash Karp Matlab Code - 2 new ---------------------------------- ... "typographical error" means any error that causes a difference between what was intended to be written, and what was actually written. In this case it would be a 'brain typo', ie. the brain consciousness signals to write 'W' and on that signal's path through the systems which convert conscious will into motor actions (probably in the section of the subconscious which fixes spelling errors), it became the signal to write 'U'. Another example of this, when CBFalconer wrote the other day "fflush(stdin)" when he meant to write... - Sun, Sep 5 2004 5:44 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/53267a06e227db80 how flushing standard io - 4 new ---------------------------------- I have some printf statements in my code and they arnt printing out. They only print out with \n on the end. That tells me i need to flush the buffer. But i dont know how. I am using gcc and linux, dont know if that matters ... - Sun, Sep 5 2004 6:12 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/71dbf59a787f4b52 How to make the text stand out - 4 new ---------------------------------- I am programming C in linux and i just need a quick and dirty way to make some text stand out. I would like to change the color maybe to red. I want to print out something like printf("Blah: This is my message."); Blah: This is my message. I would like blah to be red. if not red than maybe bold or some way for it to stand out. thanks ... - Sun, Sep 5 2004 6:45 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9591f14914140342 scanf pushes back two chars? - 8 new ---------------------------------- I ran the following program on gcc: ... int main(void) { unsigned int i; char c; if (scanf("%x", &i) == 1) ... if (scanf("%c", &c) == 1) ... return 0; ... I gave it the following input: 0xg I expected the first scanf call to fail, since 'g' is not a hex digit and "0x" is not a hex number. The 'g' would then be pushed back onto the input stream, and the only output would be: c = g Instead, I got the following output: i = 0 c = x Is this output correct? It seems like the first scanf call must have... - Sun, Sep 5 2004 9:24 pm 8 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2dbcbc42c07aa8a Different outputs in different environments. - 2 new ---------------------------------- Groovy hepcat Raja Kiran Kumar Reddy Sandireddy was jivin' on 1 Sep 2004 10:52: 01 -0700 in comp.lang.c. Re: Different outputs in different environments.'s a cool scene! Dig it! ... A man called his doctor on the phone and said, "Doc, it hurts when I do this. Can you tell me what's wrong with me?" He then hung up. Can you imagine what was going through the doctor's mind at that moment? Later the man called the doctor again and said, "Doc, I would have sent you an X-ray of my whole body, but I would have had to use a very... - Sun, Sep 5 2004 10:59 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6787ac680d5a6f90 Compiler (gcc) option to abort on nan? - 4 new ---------------------------------- Hello, am developing a floating point intensive program with gcc. At some point in the calculations i get 'nan' ascribed to a variable, this is *wrong* ( i.e. a bug in my code), however the program happily continues execution, propagating the nan around. Since I know that the occurrence of a 'nan' is an error (in my code anyway), I would like the program to just dump core at that point. Is it possible to compile/link the program in a way which achieves this? Best Regards Joakim Hove ... - Mon, Sep 6 2004 2:19 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f39345e670278593 Problem with binary strings - 5 new ---------------------------------- I'm trying to a very simple encryption key generator. I have hard coded a 10 binary string into an array, I then want to permute that string using another array with element of type int for 1 to 10. Then I'm using this as an index to copy to an output array, but offcourse the integer 10 is reading the non- existent 11th element of, could someone help with a solution to my problem, I would prefer to get the binary string from keyboard but I had problems. below is the fragment I'm having problems with. ...... - Mon, Sep 6 2004 5:50 am 5 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/69310b84d2729bed define a data type of 1 bit size - 22 new ---------------------------------- Sorry if I am too naive, but this is my first post... I have a binary variable (it can contain either a 0 or a 1). Is there any way I can define a data type that uses only 1 bit. So far I have defined it as a char variable. I've searched everywhere but I don't seem to find any place that explains how to define this type of data type. The closest thing I've found are bit fields in structures, I would like something like bit fields but without the structure. something like unsigned MyVariable :1; Thanks, Angel... - Mon, Sep 6 2004 6:35 am 22 messages, 11 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/586b37c8227a9ded data type promotion - 3 new ---------------------------------- Hi all Will the following stuff passed to foo() be promoted to an unsigned long? unsigned int ui; foo(ui << 8); (I get a compiler warning me something is mismatched in the formal versus actual arguments, but all types are correct) . Thanks John ... - Mon, Sep 6 2004 6:44 am 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/123a759e840bf11a malloc and free - 25 new ---------------------------------- This is my first posting, please excuse me if it is off-topic. I'm learning to program in C. It's been almost ten years I've been programming and a lot of things have changed apparently. I understand from other postings that casting a result from malloc isn't good. In the past I have always been casting the malloc. I think it was even necessary. (But that's a long time ago, I hadn't heard of a standard for C these days). Was it really necessary or did we do it only to silence the warnings ? (cfr. FAQ q7.7 - I can't... - Mon, Sep 6 2004 8:39 am 25 messages, 14 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9dc6bf671c014afb Newbie Question about #ifdef - 2 new ---------------------------------- In case someone googles this and would like the result, here it is. The # ifdef is a compiler directive; although lseek and read are not available on Windows natively, they are available through this other mechanism. After Jack's post, I looked around and found the definition for the standard functionality for the two methods - nothing magic in what they do and easily replicated in Java: private byte[] pread (RandomAccessFile raf, int startLocation, int numberOfBytes) throws Exception { byte[] buf = new byte[ numberOfBytes];... - Mon, Sep 6 2004 5:23 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/590a95e41276f91c Entering a binary string - 4 new ---------------------------------- Sorry for the ambiguity of my last post, What I am try to do is enter a 10 bit binary string eg: 1110001010 and then permute them into an array using an array containing 3,5,2,7,4,10,1,9,8,6 as the index, so the 1st bit will be in the P10_out[3], 2nd bit in P10_out[5] and so on. I am sure the problem is to do with the input string, it is each 1 and 0 of the input is not being read as individual elements. Your help is much appreciated. ... main() { int P10[10]= {3,5,2,7,4,10,1,9,8,6}; int P10_out[10]; int i,index;... - Mon, Sep 6 2004 9:44 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/1fa08149b8d1116b Mail bomber - 10 new ---------------------------------- May i know is there any way that we can write a mail bomber program in c language and then use it to flood a person's account .. i know that this is possible in PHP or java but don't know is it possible in c ? ... - Mon, Sep 6 2004 11:24 pm 10 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a9a6f2cd750025c9 Welcome to comp.lang.c! - all new ---------------------------------- Welcome to comp.lang.c! This post is intended to give the new reader an introduction to reading and posting in this newsgroup. We respectfully request that you read all the way through this post, as it helps make for a more pleasant and useful group for everyone. If you are new to newsgroups in general, you can learn a lot about how to get the most out of newsgroups by reading the links below: ... With that said, please keep in mind that comp. lang.c is a group for discussion of general issues of the C programming language, as defined... - Tues, Sep 7 2004 12:19 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/414c543300d9b06c C++ wins over C !! - 7 new ---------------------------------- ... no, its not. ... - Tues, Sep 7 2004 1:38 am 7 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2496e069f9974a58 brother tree insert - 2 new ---------------------------------- Hi, could somebody explain me, howto insert and delete keys in a "brother tree". (I know, the question may be offtopic, because it's about datastructures and not about c, but I have not found a proper newsgroup) thanks Dominic ... - Tues, Sep 7 2004 2:38 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/621d7c768847b981 +++i - 40 new ---------------------------------- Sir, I dont know how to use this synatx is it valid and if at all how to use it Thanks, kapilk ... - Tues, Sep 7 2004 3:42 am 40 messages, 20 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3d42b0520ce505c0 Function Call Tree Command in UNIX. - 6 new ---------------------------------- Hi Everybody I have been looking out for a Function call tree command in Unix environment. Given a piece of source code(millions of lines), there is a function F1() calling F2() calling F3(). The tools should analyse the C/C++ source code & provide a tree-like structure denoting the sequence of calls made by a particular function.. I know that VC++ IDE do provides this facilities, but not aware in the case of UNIX. Please let me know if any body has come across such a tool in UNIX environment. Thanks & Regards,... - Tues, Sep 7 2004 5:52 am 6 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e21d828db9f0efe0 console library - 2 new ---------------------------------- ... 2. Try http://www.fsf.org 3. Try Source Forge: http://www.sourceforge. net 4. Try C|Net: http://www.cnet.com ... - Tues, Sep 7 2004 6:28 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/acb25de483259711 switch and if..else same at assemby code ? - 11 new ---------------------------------- Hi, is the assemly code for if..else and switch statements similar. I would like to know if switch also uses value comparison for each case internally or does it jump to the case directly at the assembly level ? for a performance critical application is it better to to use switch case or accomplish the same using fn pointers ? please advice. Thanks for your time. prakash ... - Tues, Sep 7 2004 7:23 am 11 messages, 9 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/572cdb5d194ea929 > > > > matt parker alias [EMAIL PROTECTED] matt parker alias evon lindtherzog@ yahoo.com matt parker alias [EMAIL PROTECTED] matt parker alias [EMAIL PROTECTED] matt parker alias evonlint [EMAIL PROTECTED] matt parker alias [EMAIL PROTECTED] - all new ---------------------------------- ...... - Tues, Sep 7 2004 7:31 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/728f1bf8808847db Book Recommendations? - 13 new ---------------------------------- First I wish to appoligies if this is OT and should be posted elsewhere. I've done a google group search and read the Comp.Lang.C FAQ in hopes of avoiding a OT or FAQ. Please direct me to a better group if this is OT :) I am wanting to incress my understanding of programming practises used by professional C programmers. I feel comfortable with C programming and modifing existing programs, but feel at a lost when I wish to start my own project. I understand that there are steps professional programmers usualy... - Tues, Sep 7 2004 9:16 am 13 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/aabbf175e3e0d3a1 cmsg cancel <[EMAIL PROTECTED]> - all new ---------------------------------- Article cancelled by author ... - Tues, Sep 7 2004 9:41 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/96f8b6a3ef40f605 volatile expression - 12 new ---------------------------------- Given this code: extern volatile unsigned char v; int main(void) { v; return 0; ... My understanding is that that "v;" is an expression statement which should be "evaluated" as a void expression for side effects, but that "evaluation" requires an operator. Does changing the statement to v + 0; or (v); change this? I have some compilers which do and some compilers which do not access "v" with the above code. ... - Tues, Sep 7 2004 12:21 pm 12 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/36953aa1b62af842 YOU LITTLE BITCH! - all new ---------------------------------- Listen carefully motherfuckers! I am Lady Amanita, your new queen. Get down on your knees and worship me you scumbags! ... - Tues, Sep 7 2004 12:14 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8b3db2539be05495 Will EXIT_SUCCESS and EXIT_FAILURE have the same value on all platforms? - all new ---------------------------------- On Mon, 30 Aug 2004 11:00:25 -0700, Ben Pfaff wrote: ... assert(anyarg) given with NDEBUG is ((void)0). Although why this was so tightly specified is not clear to me; no program could distinguish it from any other void expression, except by stringizing. __LINE__ and possibly __FILE__ following a #line directive can be made the same, and __LINE__ already is for an identical source file. - David.Thompson1 at worldnet.att.net ... - Tues, Sep 7 2004 8:02 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2df1fc487ba47799 simple word wrap problem not wrapping - all new ---------------------------------- On Wed, 01 Sep 2004 02:33:34 GMT, Douglas G wrote: <snip> ... This is your problem. You want to search for a character that is either a space or tab; to do that you want to skip every character that is not space AND not tab. As written this should fault or hang if executed; the condition buffer[i]!=' ' || buffer[i]!='\t' is true for every possible character and will keep decrementing i, and also start_point, down past 0 (the beginning of your buffer); that is already Undefined Behavior, and on... - Tues, Sep 7 2004 8:03 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b27caad5393ba1ea creating a 2-d array using dynamic memory allocation - 7 new ---------------------------------- i want to create a 2-d array containg r rows and c columns by dynamic memory allocation in a single statement so that i will be able to access the ith and jth index as say arr[i][j] how is that possible? ... - Tues, Sep 7 2004 11:51 pm 7 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d8d5e8af9d1e9cc6 parsing in C - 8 new ---------------------------------- Can someone suggest some good links for the "beginners" about how expressions are parsed in C ? thanx.. ... - Wed, Sep 8 2004 12:04 am 8 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e604398031a98a42 Structure Query.... - 3 new ---------------------------------- typdef struct { int i; char ch; ... char x, y; main() { //do nothing ... In the above piece of code the structure needs a padding of 3 more bytes ( the total size of the structure variable being 8 bytes). Now my question is, wont the compiler append x & y to the end of structure and adds just 1 byte as the padding? In my case I use MSVC compiler. When I checked the size of obj in the map file the obj size was 12 bytes....shouldnt it be 8 bytes ideally?? Thanks in advance... Regds Sachin ... - Wed, Sep 8 2004 2:18 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/21ba2dda5fdbb1af Creating a va_list - 4 new ---------------------------------- Hi, I have a situation where I do not know the number of arguments I pass to a function at compile time. So is there any way, that we can programmatically create a "va_list" and then pass it to the function that can the use to do some sprintfs ? Thanks -Hari ... - Wed, Sep 8 2004 2:19 am 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8263f3a375489de2 C program to flowchart - 3 new ---------------------------------- Hello Group, I am working on a project to derive a flow chart from a c program. Can any one please help me on what tools/methods i need to use. thanks Vj ... - Wed, Sep 8 2004 2:52 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8b4b719abb6b581b Open a file in C - 6 new ---------------------------------- Hello All, I am want to open a file in C language where in i know the location of the file, but do not know its name. For this what i have done is: - 1) Used system command like and listed all the files at the location ( using ls) and stored the output in another file at a different location. 2) Then i open this new file (created after ls) and read it line by line. All these lines will have the name of the files which needs to be pened by me. 3) Then I concatenate this file name with the location of the file... - Wed, Sep 8 2004 3:53 am 6 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/bd5d79151b38ddb operator overloading - 13 new ---------------------------------- Hello All ! In c++, are basic data type int,char,long,..,etc. classes ? And if so, How can i overload new and delete operators for this this objects ? Thanks in advance ! Chetan ... - Wed, Sep 8 2004 4:24 am 13 messages, 10 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/128f20d854c7e9e3 parsing time string, getting timezone - all new ---------------------------------- Hi all, I have some trouble with the following: I'm getting a time string, in YYYY-MM-DD HH:mm:ss format, which I need to translate into a string with DD-Mon-YYYY HH:mm:ss +HHMM, where the last part is the timezone offset. I've tried to do it with the following function. This works for me, I get +0200 for the timezone part, which makes sense, because we're on daylight savings time at the moment here in the Netherlands. However, another user of the same code is located in Australia, he gets +1100 as timezone offset. It's winter... - Wed, Sep 8 2004 5:06 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/68e3ee36eecae755 MARKING STRUCTS PROCESSED - 7 new ---------------------------------- Dear All, Apologies if this is OT. I have a C program which processes an arbitrary number of structs that are stored in a hash table. (The nature of the processing and the layout of the structs is irrelevant to this post, so I wont bore you with the details). My problem is that I need some way of distinguishing the processed structs from those that are unprocessed. Obviously, I can add a `processed' field to the struct definition - but, I don't want to do this as the struct is part of a public API and I want to keep internal... - Wed, Sep 8 2004 7:11 am 7 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fdb3764e11757a48 Problems implementing Rijndael - 2 new ---------------------------------- ... What do you mean? Do you: a) have C implementation(s) and want to use them in Delphi? b) have Delphi implementation(s) with above declaration(s) and want to use them in C? c) none of the above, you just want an Rijndael implementation in C, no matter how and which? ... - Wed, Sep 8 2004 8: 04 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c9381eed95918371 Cracking C structure - 2 new ---------------------------------- For testing purposes it would be convenient to load dummy values into a set of C structures. These structures are complex (in the sense of a mix of data types), they are quite large (total number of elements) and they will have a tendency to change over time. I would be best if the dummy data was "meaningful", real dates in a date field, a small number in the number field, a short string in a text field, etc. Is there a way to load the data without having to walk through each element of each structure. I would be time... - Wed, Sep 8 2004 8:57 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/5eb96610175cb6ee mmap queestion - 2 new ---------------------------------- Hi to all, programming ANSI C on UNIX (Tru64 5.1A, but I hope it is not important). I need to load an executable in memory (ex: a copy of /usr/bin/ telnet) and start it from memory. While executing telnet_copy, delete the copy. Is it possible using mmap ? Could you provide a short example ? Thank you very much. Vic ... - Wed, Sep 8 2004 9:32 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ab27540eb9ec4872 is this code safe? - 3 new ---------------------------------- On Wed, 8 Sep 2004 18:21:03 -0400, "Songling" wrote in comp.lang.c: ... No, the code is hideously unportable and hideously unsafe. ... Assuming you mean unsigned long for U32, this is completely unsafe. If you want a pointer to void, why not define a pointer to void? void *msg_ptr = NULL; ... On the compiler I was using at work today, sizeof(unsigned long) is 32 bits. ... No guarantees at all on casting a unsigned long to a pointer to void. ... No guarantees at all on casting a pointer ... - Wed, Sep 8 2004 7:59 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c8e79374e6e5f877 two dimensional arrays passed to functions - 4 new ---------------------------------- I'm trying to pass an array of string to a function without knowing how many strings I have beforehand. I've defined one functions as char * insert(char table[256],int cols, char values[3][256]); out of deperation because when I defined it as char * insert(char table[255],int cols, char values) I keep getting no data passed. char * insert(char table[256],int cols, char values * [3]); Gets me only one arguement passed. I thought I used to do this all the time. In fact, main does this. I've loaded the entire source code I'm... - Wed, Sep 8 2004 9:42 pm 4 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/76c88cb0e98ad73f removing Spaces - 11 new ---------------------------------- Hi, Everytime I received a fix-length of string, let say 15 (the unused portion will filled with Spaces before receive), I want to remove the Spaces from END until I encounter a non-space char. let say: testBuf is the buffer that receive this fix-length string. printf("[%s]",testBuf); Output: [Hello World ] How to remove the spaces to become [Hello World] ? Any fast and effcient C algorithm like using strchr,etc? Thanks. ... - Thurs, Sep 9 2004 2:24 am 11 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/166d28f6a22645d0 Call for Papers: 38th Annual Simulation Symposium - all new ---------------------------------- Our apologies if you have received multiple copies ... ... The Annual Simulation Symposium is a forum for the exchange of ideas, techniques, and applications among practitioners of simulation in industry, government, and academia. This international Symposium is the oldest continuously operating conference/symposium dedicated to simulation. The paper sessions are designed to promote discussion of concepts, tools, methodologies, and results between authors and the audience. The structure of the Symposium also provides... - Thurs, Sep 9 2004 4:05 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9cf1d32645b5197d file operation - 3 new ---------------------------------- Hi, I have following in my data file: <12345> <4567> <8383245> I want to write a function that display according to the line number given (Max line number is 5), without the '<' and '>' Example: DisplayInfo(1) will display:- 12345 Benjamin Single DisplayInfo(2) will display:- 4567 Stephen Married ... and so on. ... void DisplayInfo(int linenum) { ... Any hints/ tips will be great. Thanks. ... - Thurs, Sep 9 2004 10:03 pm 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/afa8368925636b60 Postfix / Prefix Operators on array / pointer, search key word wanted [OT] - all new ---------------------------------- By searching with following key word in google clc and google's WWW archives: ... I get some links for the question in subject line. Bitwise operator is a constrain. So I need not search about it. ... Can Any body help me with the ideas for more proper key words for the subject (i.e. Arrays and C operators) to search both clc and google's WWW for links? Thanks ... - Thurs, Sep 9 2004 10:58 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ec29e483cf1f1ce9 Coding statements before declaration-a doubt on standard!!! - 2 new ---------------------------------- Dear all, Whats the notion behind C standard preventing declaration in middle of statements?While C++ allows this will it not be good if this supported in C also? Also theres some point if we refer to some variable which is not declared so preventing of in between declarations can be supported.But what if i simply want to do printf "hello world" in between declarations? expecting wishful thoughts from beautiful minds, Regards, s.subbarayan ... - Thurs, Sep 9 2004 11:24 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/1c6d82a9018a8db Does realloc "move" a block it shortens? - 2 new ---------------------------------- I guess this program has undefined behavior, as far as ISO C is concerned. Anyone knows an implementation where realloc actually moves a block that it shortens (as opposed to grows?) ... char *CopyStr(const char* s) { size_ t n; char *p; n = strlen(s)+1; if ((p = malloc(n))==NULL) exit(EXIT_ FAILURE); memcpy(p,s,n); return p; ... void ShortenStr(char* p) { size_ t n; n = strlen(p); p = realloc(p,n); /* could this move p ? */ p[n-1] = '\0'; ... int main(void) { char *p; p = CopyStr("0123456789abcdef");... - Thurs, Sep 9 2004 11:42 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d20134ca0362e5fc Please find out what is wrong - 4 new ---------------------------------- Hello experts, please consider the code fragment:- ... int array[] = {23,34, 12,17,204,99,16}; int main() { int d; for(d=-1;d <= (TOTAL_ELEMENTS-2) ;d++) ... It doesn't print the elements of the array? Thanks in advance. ... - Fri, Sep 10 2004 1:00 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/154185c3ce757cfa ======================================================================= You received this message because you are subscribed to the Google Groups "comp.lang.c". comp.lang.c http://groups-beta.google.com/group/comp.lang.c Change your subscription type & other preferences: * click http://groups-beta.google.com/group/comp.lang.c/subscribe Report abuse: * send email explaining the problem to [EMAIL PROTECTED] Unsubscribe: * click http://groups-beta.google.com/group/comp.lang.c/subscribe ======================================================================= Google Groups: http://groups-beta.google.com ------------------------ Yahoo! Groups Sponsor --------------------~--> $9.95 domain names from Yahoo!. Register anything. http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/BCfwlB/TM --------------------------------------------------------------------~-> <a href=http://English-12948197573.SpamPoison.com>Fight Spam! Click Here!</a> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/kumpulan/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
