comp.lang.c http://groups-beta.google.com/group/comp.lang.c
Today's most active topics: * Not STD C is "not C" ? ----WAS: Re: C to Java Byte Code - 79 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/88cb533585cafed4 * Why C? - 21 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2501c2e7176dbf * address of a statement in C - 15 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9c7bf5671accbcf6 * derangement: coding review request - 14 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63c5271ccb9149a * getch? - 13 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/96f309e1d68b9fc7 Active Topics ============= Newbee array pointer question - 7 new ---------------------------------- On Mon, 1 Nov 2004 17:56:41 UTC, [EMAIL PROTECTED] (Martin Andert) wrote: . .. It works perfectly as designed. ... You receives the address of a buffer here. You should change the interface to this function as you has to deliver a pointer here. void *init(void) ... Now you overreides the local copy of the bufferaddress. By that: the cast is superflous. You tries to hide the possible case that you miss the prototype of malloc, going into the lands of undefined behavior. But even here as you have included stdlib.h... - Tues, Nov 2 2004 12:53 am 7 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/66b69c0bf72c4e07 Pro*C Compiler - all new ---------------------------------- ... ... Not here, no. Try a data base group, this is off-topic here. ... - Tues, Nov 2 2004 12:58 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/aa7354d3c36d254b Newbie fgets problem - 6 new ---------------------------------- On 1 Nov 2004 21:37:37 -0800, "Mike Deskevich" wrote in comp.lang.c: ... No, testing for feof() before reading is bad advice, and leads to problems. See the FAQ: ... - Tues, Nov 2 2004 1:02 am 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/404a2bcef9324c43 qsort + structure problem - 2 new ---------------------------------- Thank you all for reply, I did my assignment before I got the first reply but anyway I learned more from you guys. The only problem I had when my teacher check the assignment is memory leak. I don't know where I made mistake may be you guys can tell me since my teacher just check the leak by a some linux command and he didn't give me any positive feedback about it.Also you can tell me about where I can improve my programming in c. /**************** Code ***** ***************/ ... /************ FUNCTION PROTOTYPES... - Tues, Nov 2 2004 1:12 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fcdf62618dc133be Can use macros to solve this problem? - all new ---------------------------------- ... Umh, if it already is in the API, I would not #undef it. Or, if you cannot do without: #include the respective header _after_ your own headers/ function definitions. Only if there is no choice, #undef it and afterwards # define it again. As you only are getting DrawTextT, DrawTextA, and DrawTextW, this should not interfere with anything else. As I said: Using function pointers may be safer. Cheers Michael... - Tues, Nov 2 2004 1:13 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9d10811ec434717 C... Why not c++? - 9 new ---------------------------------- ... I'm not sure this is one topic, but anyway: Have you ever met a programmer who knows C++, all of it? I haven't and I don't believe they exist. All C++ programmers write in their own particular subset of the language. Some use objects, but otherwise use the language like C, others use the STL but little else, still others use almost all of it. This can make coding easier, but makes understanding the code of others frightening. ... - Tues, Nov 2 2004 1:31 am 9 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/729e593ab5747942 assert( x > 0.0 && 1 && x == 0.0 ) holding - 12 new ---------------------------------- ... Why? As the OP used nextafter() in his failing example, at least this is correct; and for many choices of f(), this also is possible. If f() is keeping track of the way everything is rounded, then you certainly can ask for >=. The point just is that you have to be very careful. BTW: I rather like the "extended" version of the Goldberg paper provided by Sun. ... With certainty. ... The gcc/x86 issue has been brought up time and again -- in fact, my first post to c.l.c was about that. Most people initially are not sure whether the double cast has to... - Tues, Nov 2 2004 1:50 am 12 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d35b138dec22feed Survey on Newsgroup Behavior - 5 new ---------------------------------- 1. I agree that the survey is not perfect, but I guess that there's no perfect theory out there. Sure, I'll not be able to say anything about all the newsgroups that are out there, but don't you think that analyzing one newsgroup can contribute to the overall understanding of newsgroup behavior in general? 2. There definitely is a bias introduced through the self-selection of participation. But since I try to figure out what makes friendly, constructive members participate in the way they do, I believe that... - Tues, Nov 2 2004 2:03 am 5 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/68b2a03b7c9914d0 C Help Magic Square - all new ---------------------------------- On 01 Nov 2004 20:41:54 -0800 ... <snip> The C standard does not discriminate between warnings and diagnostics, and once a compiler has produced the required diagnostic it is allowed to produce a program. So yes, gcc is allowed to do this since it has produced a diagnostic.... - Tues, Nov 2 2004 2:50 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a8e92dea7e243f02 4-bytes or 8-bytes alignment? - 5 new ---------------------------------- mrby wrote: ... It might very well fail somehow also, as you invoke undefined behavior with the above. On most common machines with a flat memory layout you'll get the diffrence in memory locations though. The compiler/linker might decide reorder your 2 variables... ... - Tues, Nov 2 2004 3:12 am 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2f9b2d6fb000e16e Why C? - 21 new ---------------------------------- Delphi is a nice programming environment, no doubt about it. C programming environments are starting to catch up now though. ... - Tues, Nov 2 2004 3:37 am 21 messages, 13 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2501c2e7176dbf Please review my tutorial - 5 new ---------------------------------- ... That's a common neophyte mistake which I believe results from the neophyte reading header files, in order to try to learn C. Header files use the underscore naming convention because the programmer is supposed to know that he's not supposed to do that also. ... - Tues, Nov 2 2004 3:39 am 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a1ca8b5c0397a03b Get System Memory in C - all new ---------------------------------- ... Apart from which, if you pull this stunt on a multi-user system, your sysadmin _is_ going to slap your wrists. Hard. Richard ... - Tues, Nov 2 2004 4:15 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/97f4da4890fe4c32 Not STD C is "not C" ? ----WAS: Re: C to Java Byte Code - 79 new ---------------------------------- ... Anything not prohibited by the C standard is C. Anything not in the standard is not the C language itself, but it does not follow that it is not C. To permit me an analogy, any conversation in English is English. However, that doesn't mean that the coversation is *about* English. To argue that anything not explicitly defined in the C standard is not C is to argue that conversations that aren't about English aren't in English. Of course, this has no bearing on what is or isn't topical on ... - Tues, Nov 2 2004 2:39 am 79 messages, 17 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/88cb533585cafed4 A bit off topic; setjmp/longjmp - all new ---------------------------------- ... I have news for you: gcc is *not* a complete implementation; it is missing *exactly* the part the OP needs: the standard C library. No point in directing the OP to another compiler without what he needs. Dan... - Tues, Nov 2 2004 6:40 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ed72cab798ebd303 char array initialization: Is 'char a[] = ("a")' valid ANSI C? - 9 new ---------------------------------- [Flash Gordon] ... I agree, but the authors of the HP aCC compiler and a bug reported against GNU C compiler disagrees. See <URL:http://gcc.gnu.org/ bugzilla/show_bug.cgi?id=11250> for the GCC bug report. I'm trying to find out if they are correct or not. The HP aCC compiler reject the code with an error, and a future GCC will issue a warning when using -pedantic. I guess I need a good ANSI C lawyer. Anyone around? ... - Tues, Nov 2 2004 7:35 am 9 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2f5945f014c2cbd0 file io trouble - 6 new ---------------------------------- I can get files into my progs on the command line. For example if I wanted a text file to act as if they were my keystrokes I would type the executable name and then 6 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f32ca2eee4b16894 derangement: coding review request - 14 new ---------------------------------- ... It depends on your current standing. The OP has recently asked for help with exercises 1-6 and 1-7 in K&R2. And the guy who designed Java decided that pointers are too difficult for most programmers, so he decided to hide them in the closet. Dan... - Tues, Nov 2 2004 7:34 am 14 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63c5271ccb9149a comparing unsigned long and unsigned int - 4 new ---------------------------------- ... Well I understood the fact that no value of ui can make this condition false. But when I replaced 0ul with 0u I didn't get the warning.When I retained ul and compiled it on a 32bit machine ( ul == 32bits ) I didn't get the warning either. I was just trying to understand the significance of ul being 64 bits to trigger this warning.I should've mentioned this in the original post. ... - Tues, Nov 2 2004 7:53 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8da26f3fced58ab5 I can take it deep - all new ---------------------------------- This part of section two is the best: "Her frog was difficult, durable, and plays above the planet. It will undoubtably laugh on stale pretty swamps. " hihi, you have to love those auto-generation things... what would this email have been for? to kill off someone's mail box. pretty original way to do it I say... ... - Tues, Nov 2 2004 7:59 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3e6f33a9175539f3 Newbie: problem with strncpy - 3 new ---------------------------------- Hi I decided this afternoon that it was time I learned a bit of C and to set me going had a stab at the 'bitflip' sample problem from the topCoder website. This requires the program to calculate the minimum number of flips of sections of a binary string necessary to convert the string to all zeros. My code for this problem is posted below - but it doesn't quite work! It appears that if more than 4 flips are required, the strncpy function (called in the function flip and used to copy the leading zeros) copies the whole string rather than... - Tues, Nov 2 2004 8:05 am 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/43a871c64515f3c5 Trouble using string functions - all new ---------------------------------- ... Hohum. Beware the snark. I've said the same thing before. There was this other computer, which was supposed to generate data, and that was sent to me to process. So I wrote a program to process it. Should be a simple job - after all, it was all computer-generated data, and what reason could they possibly have for changing the format? No prizes for guessing what happened two months later. Richard ... - Tues, Nov 2 2004 8:11 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e35bc0ebbb3f46f0 getch? - 13 new ---------------------------------- Hi, How do I read a char from stdin before the '\n' is pressed? for example I know that I can use getch() to read a single char from the user input, but suppose I wanted to read before the carriage return is pressed. for example I type a char and the following actions is done before the '\n' is pressed. Thanks ... - Tues, Nov 2 2004 8:36 am 13 messages, 10 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/96f309e1d68b9fc7 Game looping problem? - 5 new ---------------------------------- ... The only reason that was set to 1 is to make it run faster for now. Later I will increase the number. The looping issue is with the Y or y or N or n. What would I need to ammend or change in order to make this run right? ... - Tues, Nov 2 2004 9:05 am 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/65489e66f17dc78c How to best do the following string operations... - 3 new ---------------------------------- I want to reproduce a string search and replace between to arrays that I have done in perl using very little code. I am not sure how best do this without overdoing it... I have the outline of the code written below - I just need to know what is my next best steps to complete it -- or a suggestion if what I have so far is not correct. Thanks, john My perl script basically inserts some postscript code for a watermark into another postscript file. Here is basic idea in psuedo perl ocode: @infile = read_file("c:\\my_drawing.ps");... - Tues, Nov 2 2004 9:38 am 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ec3b0ac3e91d7095 Complex array definition - 10 new ---------------------------------- Recently, the following definition was posted to comp.lang.c++: ... 1) Is the type of this object "array of 3 (array of two of pointer to pointer to char)"? If not, what is it? 2) Could the object be passed to functions with the given prototypes? void foo( char **bar[][2] ); /* yes? */ void baz( char *bar ); /* no? */ void quux( char **(*)bar[2] ); /* yes...? */ I don't know if the last is even legal; hence the question. ... - Tues, Nov 2 2004 9:43 am 10 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/45702c9e6fbd7d Why can't constants have commas? - all new ---------------------------------- ... It *would*, if the comma operator were allowed in constant expressions. .. . The compiler must complain, because a,b is not a valid constant expression. It need not generate a meaningful complaint, however :-) ... Most of the changes performed by obfuscators can be undone. ... Any obfuscator that doesn't translate all local names in combinations of two characters (O and 0 or 1 and l) is not a real obfuscator. Dan... - Tues, Nov 2 2004 11:03 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/63c83bd31dbb075d Write only memory - all new ---------------------------------- ... It's also most cases because these are the variables that are left uninitialised most of the time. People are a lot more careful to initialise their aggregates than their scalars. Most of the uncatchable examples are contrived, designed on purpose rather than arising from real code. Dan... - Tues, Nov 2 2004 11:09 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e31d94370ccee765 array subscripting - 5 new ---------------------------------- Hi, I've been wondering for a while now (and always forgot to ask :) what is the exact quote from the Standard that forbids the use of (&array[0][0])[x] ( when x >= number_of_columns) as stated in the FAQ 6.19 Thanks. ... - Tues, Nov 2 2004 11:29 am 5 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/818f1182b855b0ca how to "new" a two-dimension array in C++? - 2 new ---------------------------------- ... In C (as well as C++) you must know all, or all-but-one, of an array's dimensions at compile time. In C you should create a one-dimensional array with malloc() and then you can use macros to refer to it as if it were 2-d. In C++ there are other solutions, you should post to comp.lang.c++ to get answers on that. ... - Tues, Nov 2 2004 12:01 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8ff15fb67c0eb1f6 Binary files, little&big endian setting bits - 3 new ---------------------------------- ... OOI, how many bits are there in a kilobyte, if 1 byte is 32 bits? Should I start referring to file sizes in bits to avoid confusion? ... - Tues, Nov 2 2004 12:38 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/df8099a70cd0a5a8 Convert VB code to C code. - 12 new ---------------------------------- Hi, I am having trouble translating the following lines of Visual Basic code to C. For iCounter = Len(sReference) To 1 Step -1 ... fReferenceCheckSum = Right(Str(10 - (iSum Mod 10)), 1) Any ideas anyone? I have had some help, but I need to know how C's FOR loops looks like, and how "Val(Mid.." and "Right(Str..." are translated into C. Any further help would be greatly appreciated. Thanks, Kenneth ... - Tues, Nov 2 2004 1:01 pm 12 messages, 9 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a12d4a4f10e5ab75 Utility to partially preprocess - 10 new ---------------------------------- On 1 Nov 2004 19:34:11 GMT, Chris Torek ... Thanks, the man for scpp sounds like about what I want, but the only copies (3 of them) I could find won't compile (lots of lex and lex-generated code errors). I gather from searches that I'm not the only one to find that with 'modern' utilities (I'm using Debian GNU/Linux 'woody' (stable), gcc 2.95.4, lex 2.5.4, yacc (GNU bison) 1. 35). However, reading about it has given me ideas for writing my own. It's been quite a long time since I wrote a C parser in pure C, the last time... - Tues, Nov 2 2004 2:50 pm 10 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/673e19381c85f1d0 Extracting file system information - 3 new ---------------------------------- Hi, I've a C program that I need to include a routine to extract free space information on a particular mount point. Can someone provide me a sample routine on how that is done in C? I did a man on statvfs and it looks like that is the system call I should be using but I'm not clear how to use it. Any help you can provide is very much appreciated. thanks. geraldine ... - Tues, Nov 2 2004 6:21 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/43d89afe6b60d659 pointer array question - all new ---------------------------------- ... You can't. This is a case for dynamic allocation of arrays. Maybe something like ... char **color = malloc(3 * sizeof *color); color[0] = "blue "; color[1] = "green"; color[2] = NULL; The NULL is there to calculate the length of *color lest we forget. int len; for (len = 0; color[len], ++len) ; Now len == 2. To add a color we can ... color = realloc(color, (len + 2) * sizeof *color); color[len] = "yellow"; color[len+1] = NULL; ... - Tues, Nov 2 2004 6:43 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/1c7bd85f3ba939b1 Flash and C integration problem - 2 new ---------------------------------- I have a following problem: Flash control (toolbar) has to be integrated in win32 application written in C. The problem is that application is not dialog window and hasn't MFC. If it were so, the problem could be easily solved, but without MFC? Did anyone encountered, and hopfully solved, such a problem? Code example would be of great help. THX. ... - Wed, Nov 3 2004 12:56 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/bb1fd62b09c65d65 linked list - 3 new ---------------------------------- i wanted to register the content of the linked list i have created in a file, but unfortunately i couldn't register it,and i was wondering if someone would mind helping to solve that problem or giving me any idea. ... - Wed, Nov 3 2004 5:08 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fdd0f286dd389f28 Count the frequency - 3 new ---------------------------------- Hi all, Do anyone know how to write a C program to count the frequency of a certain key pattern in a given datafile? Input: Three alpha-numeric keys separated by space A data file contains M by 3 matrix of alpha-numeric keys. Where M is number of rows and 3 is number of columns. Output: Number of occurrences of the input keys Example: Input file db.txt and its content: 4 7 9 2 1 G 5 3 4 A 3 E 1 A 3 F 5 6 X 0 4 Sample run #1 Please enter 3 keys ( separated by space):7 A 4 The key 7 has 1 occurrence in the... - Wed, Nov 3 2004 6:48 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a3d98ffcb4e4d1ba a simple wget in C language? - all new ---------------------------------- ... indeed, not in standaard C. But there are some libraries which come in pretty handy, like libcurl ( http://curl.haxx.se/libcurl/ ) Ilja ... - Wed, Nov 3 2004 8:01 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9ad09da4d5ab1654 address of a statement in C - 15 new ---------------------------------- hi all, Is there is any way in the C language by which I can get the address of a statement? For eg,consider the following simple program: 1. # include 2. 3. int main(void){ 4. int variable; 5. return 0; 6. } Well is there is any way by which I can know the address of the statement which is in the line 4? Also,if I know the address of a statement then can I transfer the control to that statement by equating program counter equal to that address? Well,I can access as well as modify the program counter with the help of... - Wed, Nov 3 2004 10:52 am 15 messages, 13 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9c7bf5671accbcf6 cmsg cancel <[EMAIL PROTECTED]> - all new ---------------------------------- Article cancelled by author ... - Wed, Nov 3 2004 10:56 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/204930a3929c74bf 10 limiting display - 12 new ---------------------------------- How do you limits employee display where you enter the department for all the employee within that department be displayed and if lets say they are 100 or so and you have to limits 10 employee per page before entering anything to display the next 10 again? ... - Wed, Nov 3 2004 10:56 am 12 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/26431e15de0633b5 Seeking Borland C++ 4.5x - 4 new ---------------------------------- Can Borland C++ 4.5x be ftp'd from somewhere? ... - Wed, Nov 3 2004 11:19 am 4 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6bbf0d70e8d6823c Extract a function from C code? - 2 new ---------------------------------- ... AWESOME!!!! THANK YOU SO MUCH! This is great. codeworker is EXACTLY what I was looking for! Thanks again! ... - Wed, Nov 3 2004 11:57 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/142137b736cb8ea0 packed datastructure - how to define? - 12 new ---------------------------------- Hi Maybe this is a simple question, but I don't know how to solve. Background: A weather station connected to the serial port sends data packets. This data packets are containing variables fom one byte up to 4 byted in mixed order. Now I want to define a structure to overlay it with UNION over the receive buffer for easily access to the single values in the data packet. The problem is, that I cannot defind a variable, which only reserves one byte of memory. A simple 'char' or 'char[1]' eats 4 bytes and all following ... - Wed, Nov 3 2004 1:45 pm 12 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c777066c3577cad9 Sig handler causing core dump - 4 new ---------------------------------- I'm a newbie to C programming...so go easy. ;) I'm forking child processes, and registering a signal handler with the following: signal(SIGTERM, DieServer) ; signal(SIGINT, DieServer); DieServer is the following: volatile sig_atomic_ t dying_in_progress = 0; void DieServer(int sig){ int result; char dummy[0]; if(dying_in_progress) raise(sig); dying_in_progress = 1; // Now do the clean up actions: if(debug==1) printf("SERVER PARENT->Received SIGEVENT %d.\n",sig); wait(); close(client_sockfd);... - Wed, Nov 3 2004 2:41 pm 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ca0c4a2fe24193c9 hashlib package - 6 new ---------------------------------- I released this under GPL some time ago, (2003-May) and have been advertising it occasionally here, where it seemed applicable. I have received no bug reports. I have just gotten around to writing a usage manual for it, which follows. I would like some opinions on it. Please don't quote the whole thing back at me, a short excerpt followed by your pithy commentary will do nicely. I am off for an operation Monday, so I won't be available for a while after that, and you might as well hold things after Saturday.... - Wed, Nov 3 2004 2:55 pm 6 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e5f87805e1fd8c3f Nice way to do help screen output? - 4 new ---------------------------------- To create help output (the response to "myprog --help", for example) I currently create a big .h file, which includes a single string, such as: static char *help_text = "\ myprog: my program\n\ loads and\n\ loads of\n\ painfully manually\n\ formatted and\n\ justified text\n" There's got to be a better way to do this - any ideas? Ideally, I would like to write the help as a plain text file. Of course, I don't want to distribute this file with the program, so it needs some preprocessing. I'm on Linux.... - Thurs, Nov 4 2004 1:01 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2e257ce452b7bbeb double-linked list elements swap - 9 new ---------------------------------- Hi! I'm writing function which swaps two arbitrary elements of double-linked list. References to the next element of list must be unique or NULL (even during swap procedure), the same condition should be kept for references to previous element of list. Here is my solution below: struct node { int i; struct node *p; /* prev */ struct node *n; /* next */ ... void swap ( struct node *a1, struct node *a2 ) { struct node* a1p = a1->p; struct node* a2p = a2->p; struct node* a2n_o = a2->n; struct node* a1n_o = a1->n;... - Thurs, Nov 4 2004 1:24 am 9 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/95f5fe295433add5 Nmap Malloc etc... - 6 new ---------------------------------- Hi all...now after a lot of experiments in c programming(two weeks..for precision), i've seen another strange instraction..and i post you the question. .. Like in the subject...why i must use nmap rather then malloc????. Best regards all.. See you from Rome, Cla. ... - Thurs, Nov 4 2004 3:33 am 6 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8c4cfb6f5f876c60 detect recursive C code - all new ---------------------------------- ... Thanks for the answers, however I never found out how to use these tools so I used the excelent tool cflow instead. It prints a callgraph and marks the recursive functions. E. ... - Thurs, Nov 4 2004 4:22 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4ec4eb836acd9e9d check structure member at compile-time - 2 new ---------------------------------- Hello group, Is it possible to check the presence of a structure member at compile time using only the C preprocessor? What I have in mind could look like the following. Suppose the structures s1 and s2 look like struct s1 { int A; ... struct s2 { int B; ... Then this code snippet ... needs to produce the "struct s has a member A" message, while this one ... needs to produce the "struct s has no member A". How do I go about defining the macro EXISTS in such case? Is it at all possible? Thanks, Dmitri ... - Thurs, Nov 4 2004 6:33 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e89da2917e7509c3 caste Q - 5 new ---------------------------------- ... int main(){ int rnd; long widernumber; srand(time)); rnd=rand(); widernumber=(long)rnd; printf=("wider number is %ld\n",widernumber) return 0 . .. is necessarily an integer as a long? Q2) What do the style people think about casts in general? MPJ ... - Thurs, Nov 4 2004 6:43 am 5 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6344f8b41e8d2f87 phooey! .. The batch file cannot be found - 2 new ---------------------------------- Hi, I'm reading this: http://www.catch22.net/tuts/selfdel.asp (Self Deleting Executables) and playing around with the batch file method .. trouble is I always get a command box at the end with the "the batch file cannot be found" message .. how can I get rid of this .. while staying with the batch file method? here is my code: /*self deleting exe*/ ... int main(int argc,char* argv[]) { if(argc == 1)//no arguments passed { ... { ... { ... cheeeers cw ... - Thurs, Nov 4 2004 7:47 am 2 messages, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/58b9e2208e768190 World's First Book on Professional Data Recovery Programming - all new ---------------------------------- Hi! I am glad to introduce World's First Book on Professional Data Recovery Programming. Book also Includes a FREE CD, which contains complete Source Codes of all the software/Programs described within the book and may interesting tools You can see the contents of the book and order Online on following link: http://www.DataDoctor.biz/author.htm The Details of the Book are as follows: Title of the book: "Data Recovery with & without Programming" Author of the book: Tarun Tyagi Publishers of the book: BPB Publications,... - Thurs, Nov 4 2004 8:39 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4dcc9e4dd98da41a Graphs (BFS and TFS) - 4 new ---------------------------------- I am trying to write a program that uses graphs and I have this algorithm for the Depth First Search. //Input: Graph G=(V, E) //Output Graph G with its vertices marked with consecutive integers in //the order they've been first encountered by the DFS traversal mark //each vertex in V with 0 as a mark of being "unvisited" count<--0 for each vertex v in V do if v is marked with 0 dfs(v) algorithm for dfs //visits recursively all the unvisited vertices connected to vertex v and then assigns them the numers in the order.. . - Thurs, Nov 4 2004 8:59 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/25d50217b07d4d00 Memory allocation - 3 new ---------------------------------- HI, I would like to ask if the follwoing example is correct: char *Title= NULL; Title = "This is message 1"; - - - Title = This is another message"; It works fine for me but I was advised to use memory allocation like malloc. Is it necessary? I don't seem to have problem with it... Thank you ... - Thurs, Nov 4 2004 9:07 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/842f68391c08f38d ASCII to HEX - 4 new ---------------------------------- char string[] = "1d,4c,20,00"; char target[] = {0x1d,0x4c,0x20,0x00}; char buf[ 64]; I have searched newgroups and am actively searching online for a function to take the value of string and place it into buf so that buf == target. Any ideas would be greatly appreciated, Tyler Kellen ... - Thurs, Nov 4 2004 10:12 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d306ab416a318ecc C, C++ ve C# programcılarının buluşma noktası : cdili@ yahoogroups.com - 2 new ---------------------------------- C,C++ ve C# programlama dilleri ile ilgili her türlü konu Cdili e-mail grubunda tartışılıyor. Cdili'ne üye olarak C,C++ ve C# programcılığı ile ilgili tüm sorularınızı bu gruba yönlendirebilir, aşağıda gördü ğünüz grup servislerinden yararlanabilirsiniz. Files: C, C++ ve C# ile ilgili dokümanlar, program kodları, Türkçe ve İngilizce kitap (e-book), vb..dosyaları grubun "files" bölümünden yükleyebilirsiniz.... - Thurs, Nov 4 2004 2:27 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/c0383eac1b8a48a4 Confusion with C Part II - all new ---------------------------------- ... ... Of course. I knew that, but I had a really good reason for putting it that way. Honest. Would a magician lie to you? Well, yes, but that's another story... ... - Thurs, Nov 4 2004 3:21 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4b902db955c715bb Variadic functions - 4 new ---------------------------------- Do variadic functions (such as printf()) always scan the format string for format specifiers, even when there are no additional arguments? If it is instead a QoI issue, what would be true for a typical implementation? Basically, I'm wondering whether there is any advantage to using puts() instead of printf() for output of a string. ... - Thurs, Nov 4 2004 3:30 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/a73dc9832894a6b3 How to create a new directory in C - 9 new ---------------------------------- I remember that I could create a new folder in the current directory easily in Unix and Linux by something like system("mkdir sub_directory"); But failed to do so under Windows System. Any suggestions? ... - Thurs, Nov 4 2004 3: 46 pm 9 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2ec05d6e878117cc Giving the preorder & inorder lists, How can be constructed the corresponding B-TREE ? - all new ---------------------------------- Hi, If I have the preorder and inorder list, which algorithm does I need to build the corresponding B-TREE? where can I find some source code? thanks... - Thurs, Nov 4 2004 3:57 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/68744af9e196542d Argument Processing - 8 new ---------------------------------- Hello, I'm trying to learn how command line arguments are handled in C. The following code segment that I wrote as a test program compiles, but when I try to run it, it core dumps. This is under a FreeBSD environment. What am I doing wrong here? /* just echos the command line arguments onto the screen tests the format of argument processing */ ... int main(int argc, char argv[ ]) { int i; /* generic counter */ printf("argc = %d", argc); for (i = 0; i <= argc; i++) ... /* return to operating system */ ... - Thurs, Nov 4 2004 9:41 pm 8 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/deee1550c7aee70 ======================================================================= 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
