comp.lang.c http://groups-beta.google.com/group/comp.lang.c
Today's most active topics: * another stupid c bug. (endless for loop) - 22 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b3b9f4a263a24575 * Typedef structs - 11 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/341cf36d2ef82b01 * using #ifndef - 10 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e3d7fc770fc6d7b7 * C 99 compiler access - 10 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6ab6fa86dd3e2204 * Small C "Puzzle" - 10 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d431713d325b5c70 Active Topics ============= question about writing c code supports pipe in - 3 new ---------------------------------- Carson scribbled the following: ... Technically, pipes are an operating system feature and thus off-topic on comp.lang.c. However... <OT>On most operating systems, for example all sensible Unices, these kinds of pipes as you mention above are handled at stdio stream level. This means that the first command's stdout is automatically connected to the second program's stdin, and so on. This means that you don't have to do *ANYTHING* to make your program support pipe in. Just write your program... - Fri, Aug 27 2004 1:03 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/49fa8e6591526575 Two Questions about "strlen", "strcat" and "strcpy" - 7 new ---------------------------------- Jason Lee scribbled the following on comp.lang.c: ... (snip about fifty lines of this crap) *PLONK* ... - Fri, Aug 27 2004 1:10 am 7 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e9ba0a3a9129c3ba Changing directories from a C console program - 3 new ---------------------------------- ... wchdir expects a wide character set string, not a multi byte one. Hence, it doesn't find any directory you pass it. Rule: Use the documentation when something doesn't work. ... - Fri, Aug 27 2004 2:05 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/197a753dbf110372 fgets - 7 new ---------------------------------- ... Why 7? ... ... int main() { FILE *fp = fopen("test.txt", "r"); static char line[LINE_SIZE]; if(!fp) { ... while(fgets(line, sizeof line, fp)) { ... if(!feof(fp)) { ... return EXIT_ SUCCESS; ... Input: <11111> <22222222> <333> Output: ... The above will only work correctly if all lines are less than ;LINE_SIZE; characters. If they're larger and you don't increase... - Fri, Aug 27 2004 3:01 am 7 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b0dcdb9962f4952 Typedef structs - 11 new ---------------------------------- Hi all, I have a question that I'm having difficulty answering. If I have a struct: typedef struct my_struct_tag{ ... (I'm using the struct when declaring other because the definition of my_other_struct is in another source file.) Then, I want to access, from a different source file, my_struct *tmp; my_other_struct *other_struct; tmp->other = other_struct; But, for me, this gives a warning saying that the assignment assigns different pointer types. If I change the code to: tmp->other = (struct my_other_struct... - Fri, Aug 27 2004 3:29 am 11 messages, 6 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/341cf36d2ef82b01 Why is that? - 6 new ---------------------------------- ... Hmmm... dunno where the '\' went but indeed it was a typo. Using the unadorned 0 is a better idea, at least in this case. Thanks for the correction. Oz... - Fri, Aug 27 2004 3:31 am 6 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2e0a5fda989aea50 using #ifndef - 10 new ---------------------------------- In article <[EMAIL PROTECTED]>, ... Are you *absolutely sure* that you only have prototypes in the .h file, and not definitions? Please post the declaration of "function" from your .h file. -- Richard ... - Fri, Aug 27 2004 3:50 am 10 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e3d7fc770fc6d7b7 Determining EOF using fseek()? - 4 new ---------------------------------- Hey, I was wondering if it was possible to determine if you hit 'EOF' using fseek? I'm using fseek to traverse through the file from start to end and capturing the data into a linked list structure. However, my loop doesn't seem to work well - it totally fumbles out actually: while ((a = fseek(fp,0, SEEK_CUR)) == 0){ // code here ... Its quite important for me not to disrupt the current position of the cursor since I rely on that to fetch the data from the text file. I thought that the loop would work fine since... - Fri, Aug 27 2004 7:08 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8a2feab451c13f24 how to use the keyword extern in c? - 4 new ---------------------------------- ... your method is good only for writting code by yourself. you can not tell whether the code written by others is right or wrong, so it is good if I could have a copy of the C Standard which giving the rules what is right, what is undefined, what's wrong. ... - Fri, Aug 27 2004 7:24 am 4 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/dcb9f322acf697ba float limits - 8 new ---------------------------------- ... For single precision floating points, the fractional part of the mantissa is stored in 23 bits. The mantissa is said to have 24 bits of precision only under the assumption of the leading bit of '1'. But this leading bit business is true only for NORMALIZED forms. Now, from the C99 thingy. 5.2.4. 2.2 Characteristics of floating types <float.h> 3 In addition to normalized floating-point numbers ... floating types may be able to contain other kinds of floating-point numbers, such as subnormal floating-point ... - Fri, Aug 27 2004 8:49 am 8 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d9431935ccd372cf c question - 2 new ---------------------------------- do you mind using a more meaningful subject title than "c question" on a C newsgroups? thank you. chok jim wrote: ...... - Fri, Aug 27 2004 9:11 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e96fa69eef498f70 assigning values to a struct - all new ---------------------------------- remove the "typedef". chok ...... - Fri, Aug 27 2004 9:18 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/da6f256fa9360b33 another stupid c bug. (endless for loop) - 22 new ---------------------------------- I was just trying to figure out how some C code worked... I needed to make a loop to test all possible values for a 16 bit word. Surprise Surprise... C sucks at it... once again :D lol... C is such a bad language it amazes me everytime :D Just look at this shit: unsigned short int i; // I set i to a large value so one can see the wrap occuring. for (i=65500; i<65536; i++) { / / endless loop ... for (i=65500; i<=65535; i++) { // endless loop ... for (i=65500; i<65536; ++i) { // endless loop ... for (i=65500; i<=65535; ++i). .. - Fri, Aug 27 2004 9:43 am 22 messages, 13 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b3b9f4a263a24575 Pointers and array - all new ---------------------------------- ... Do not use comp.lang.c as a place for a Tutorials. Instead read some C links , books and FAQ. Link: http://web.torek.net/torek/index.html Chris Torek has very good description of the above in his Tutorial. Go read it. . .. - Fri, Aug 27 2004 9:56 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ee136b4e021e09fe C variable retyping - 6 new ---------------------------------- C allows type casting in which a variable is converted from one type to another. Does C (whatever standard) allow the type of a variable to change, within a statement, avoiding the conversion? And if so, provide an example of how its done. Example: int a=23; int b=34; char c='a'; int * p_int=(int *) &c; // type casting // c is converted into type integer, then b is added. (int) c + b; //retypeing (type int) c + b; // similar action *p_int + b Ignoring alignment issues, storage size issues, etc., c is retyped to an integer, no conversion is done, and c is... - Fri, Aug 27 2004 10:19 am 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/28d0e15991c933a9 pointer alignment - all new ---------------------------------- ... I guess it comes down to interpretation of the question. Yes, where the char* is stored may have alignment restrictions, but the value of the pointer does not. ... True, "PC-based computers" can store anything at any valid address without alignment restrictions. However, you do get a performance penalty for not aligning things. The compilers I use on such systems default to using alignment for such things, though you can turn this off. Many other systems forbid non-aligned values and generate a fault if you... - Fri, Aug 27 2004 10:30 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7727480744600b04 size of an integer ?? - 2 new ---------------------------------- Please don't top-post. -- Imanpreet Singh Arora ... ... ... - Fri, Aug 27 2004 12:02 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/31e9b3efedb0ab4e memset - all new ---------------------------------- "Magix" wrote ... to zero. You only need to memset() the whole buffer if you want to destroy all traces of the old string, maybe for security or debugging purposes. strcpy(szBuffer, "") or *szBuffer = 0 will both do this, but strcpy( ) will usually incur the overhead of a function call. However it is not likely that this will be in a sensitive place, so won't make a noticeable difference to running time. The reason for avoiding strcpy() is that it is a gratuitous waste of cycles and a maintaining... - Fri, Aug 27 2004 12:46 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/cd28bd5356634d20 threads without threads - 5 new ---------------------------------- Hello, I have a counter loop which actually executes in a different thread. The thread is there to check for a connection time out. However due to some limitations, I cannot use pthreads or any OS dependant components (my code should run on both windows and linux). I have to relegiously stick on to ANSIC standard. Does ANSI C provide any inherent function which could accomplish what I intend to do. Or putting it otherway, how can I just deviate from my direct execution path and just return to it after a stipulated time has elapsed.... - Fri, Aug 27 2004 12:55 pm 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/71f22bdef12f3331 function redefined problem - all new ---------------------------------- It's wonderful ! "SM Ryan" wrote in message news:[EMAIL PROTECTED] supernews.com... ... ... - Fri, Aug 27 2004 2:30 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f9ad46a0f27bd81f Socket reading problem - 4 new ---------------------------------- Hi, I'm writing an NNTP based program that downloads articles from Usenet. I've run into a weird problem. It seems as if there is a bug somewhere that causes certain articles to download incorrectly (just by a byte or two). It happens to the same articles and about 1 out of 5 have issues. So everything seems to work ok, but somewhere something causes this weird behavior. The code that should work but doesn't (sometimes) downloads an article and returns it. Any help would be appreciated. Matta - - - - - string NNTP::net_recv(). .. - Fri, Aug 27 2004 2:32 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/133946f26ab5f0e1 C 99 compiler access - 10 new ---------------------------------- I have access to a wide variety of different platforms here at JPL and they all have pretty good C 99 compilers. Some people claim that they have not moved to the new standard because of the lack of C 99 compliant compilers. Is this just a lame excuse for back-sliding? ... - Fri, Aug 27 2004 2:39 pm 10 messages, 7 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6ab6fa86dd3e2204 Small C "Puzzle" - 10 new ---------------------------------- I was taking a look at some of the C puzzles at: http://purana.csa.iisc.ernet. in/~gkumar/cquestions.html and have not had any trouble with any of them except for the first one which is reproduced below: The following C program segfaults of IA-64, but works fine on IA-32. int main() { ... Now I know that architecture dependant behavior is off-topic, but I don't really see anything wrong with the code (yes, stdlib.h is missing, int main(void), and malloc casted, but I don't think this has anything to do with the point of the problem). Am I missing... - Fri, Aug 27 2004 4:29 pm 10 messages, 8 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d431713d325b5c70 #def question - all new ---------------------------------- ... Maybe ... assuming "my_mode" is *not* a macro constant, but rather a variable set at runtime, is the following construct valid: void my_func(void) { int my_mode; my_mode = some_func(some_args); /* to get a value for "my_mode " */ int my_array[my_mode ? 10 : 20]; / to create the array */ /* ... rest of function in here ... */ return; /* end of my_func */ ... Note that the definition of "my_array" just used an expansion of macro "B". Is this legal? If so, then the OP's problem is solved (except, maybe, for a bunch of... - Fri, Aug 27 2004 5:41 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4eec303cbc3f682d Wrap rev 2. - all new ---------------------------------- ... Damned if I know either! It's a concept I got from one of the exercises in K&R2, and I've seen it used elsewhere as well. I took it to mean fully developed, especially in terms of being able to handle anything thrown at it with some amount of grace. But then, the question arises: just what does one imagine "anything" to comprise? At some point, it seems to me that one needs to closely define what is expected from an application, such that it will either act correctly in response to, or reject explicitly, any given... - Fri, Aug 27 2004 9:09 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/39399d219983b605 Is this acceptable (i.e., compliant) code? - all new ---------------------------------- ... Well, it is a standard here to teach Pascal to any engineer student(I am CS student), but it has already been discussed about teaching C instead. People decided it wasnt a good idea. But mathematical shouldnt be a problem at all to any first year students, I think... mainly engineers, that will see a lot of math later. Well, unleast it isnt here... ... - Fri, Aug 27 2004 9:48 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3e78e03521f0ff92 ======================================================================= 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 --------------------~--> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar. Now with Pop-Up Blocker. Get it for free! http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM --------------------------------------------------------------------~-> 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/
