comp.lang.c http://groups-beta.google.com/group/comp.lang.c
Today's most active topics: * why segmentation fault when copying a character? - 6 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/bae63478f0cccb85 * integer index problem - 6 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b4ba7e7b7bffcff7 * newbie: array-length - 5 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f8fcf437ad80f925 * gcc in linux - 5 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/37104369ff029628 * arbitrary array index range? - 5 new http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ace3b99f14b1bc78 Active Topics ============= Is there an open source C compiler to Stack Machine? - all new ---------------------------------- ... There is a subset C compiler that produces stack machine code that won an IOCCC award a few years. It was enough of a subset to compile itself. I think it was in the 1991 entries. ... - Tues, Oct 12 2004 10:20 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/d4db7fb43229206b newbie: array-length - 5 new ---------------------------------- Hi, how can I get the length of an array: char *test[] = {"a", "b", "c", NULL}; Thanks for help. o-o Thomas ... - Tues, Oct 12 2004 9:18 am 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f8fcf437ad80f925 Array size using pointer - 2 new ---------------------------------- ... Why not? ... No. Seriously, there is no (portable) way to find out the physical size of an array based on a pointer to the first element alone. You have two choices: 1. Save the size of the array and either pass it as an argument ... 2. Write a special sentinel value to the last element of the array, ... Actually, there's a third choice: pass a pointer to the array ( which is not the same thing as passing a pointer to the first element): int f( int (*b)[10]) { /* sizeof *b == sizeof (int) * 10 */... - Tues, Oct 12 2004 11:05 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/24fc6283b76ef439 Free C\C++ compiler - all new ---------------------------------- ... You misunderstand. It is spelling checker for undefined (mistyped) symbols. Whole Tomato has this feature too. ... watching the compiles blow up because you mistyped something. Interesting software this whole tomato... Feature matrix: Feature Whole tomato lcc-win32 IDE Enhanced listboxes yes yes Better parameter info yes yes Hovering tooltips yes only in debugger Suggestion lists yes ... - Tues, Oct 12 2004 9:34 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4aca51d9a5903ba5 Is this legal ? - 2 new ---------------------------------- Chris Dollin scribbled the following: ... In fact, as I realised after replying to Mabden's post, he *is* using p in the above code. ... - Tues, Oct 12 2004 9:47 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8c1b4f1068ac4449 why this C code did'nt works as expected - 3 new ---------------------------------- ... ... A sin gal? How do you handle one of those? Brian Rodenborn ... - Tues, Oct 12 2004 9:31 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ff6d5e5f30280c50 why segmentation fault when copying a character? - 6 new ---------------------------------- Hi, This might be a sort of FAQ, but I don't see why, so I would someone help me to understand what's wrong? I've just created following code which wold trim white space(s) in a (given) string. But, it resulted the Segmentation fault, and so as when running in gdb (saying "Program received signal SIGSEGV, Segmentaion fault at *p++ = *st++"). The platform is Linux kernel 2.4.27, gcc version 2.95.4 20011002. /*-------------------------------------*/ ... int main(int argc, char ** argv) { char *st = "Hey, how are you?";... - Tues, Oct 12 2004 11:36 am 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/bae63478f0cccb85 integer index problem - 6 new ---------------------------------- ... We don't know that; if you don't post the actual code that you compiled, we can't tell where the problem is. Where is "radian" predefined? What does its declaration look like? Reduce your program to a small example that exhibits the problem, one that we can cut-and-paste, compile, and execute on our own systems. If the workings of the Gaussian_quadrature function are irrelevant, just print the values of min and max. Tells us what output you're getting and what output you expected. Looking at your original (incomplete)... - Tues, Oct 12 2004 12:35 pm 6 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/b4ba7e7b7bffcff7 LNK 2001 error using the cl compiler?? - all new ---------------------------------- Mary wrote: ... No, you didn't. There is no such thing as a 'class' in C. Perhaps you meant the different languagee C++, for which there is a newsgroup news:comp.lang.c++ but ... ... Win32 API functions and DLLs are not part of C++ either. Perhaps you want a newsgroup, mailing list, or tech support for your implementation or for Windows. ... - Tues, Oct 12 2004 12:07 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6261d4452c52a3b7 Newbie questions - Couple of VC++ questions regarding dlls and VB6 - 2 new ---------------------------------- [EMAIL PROTECTED] (Ali Syed) wrote in news:26c82868.0410121201.1a2c5948@ posting.google.com: ... __stdcall is not part of C. ... C++ is not C. DLLs are not part of C. ... VB is not part of C. ... delete is not part of C. . .. Ini files are not part of C. ... There are no classes in C. ... Unknown, VB is not part of C. ... I'm puzzled why you thought this had anything to do with C. You should find a win32 programming newsgroup for these types of questions. ... Sure, no problem. ... - Tues, Oct 12 2004 1:26 pm 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/2ec708b4eed51126 friends, namespaces and operators. - all new ---------------------------------- ... Please direct your questions about C++, a different language from C, to news:comp.lang.c++ ... - Tues, Oct 12 2004 12:08 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fcd1aaf2c2c3ac87 Doubt about getchar() and scanf() for a character? - 4 new ---------------------------------- Hello, the following code does not work: " ... void main(void) { char option; printf("Choose an option: "); option = toupper(getchar()); printf("Chosse another option: "); scanf("%c", &option); ... " It shows "Choose an option: Choose another option ". Why? Whether I put two lines "fflush(stdin)" before the inputs, the same above occurs. my gcc: "$ gcc -- version gcc (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)" TIA, Vinicius. ... - Tues, Oct 12 2004 12:55 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/51c1193faf9d688 Copying structs - 3 new ---------------------------------- ... Any specific reason why you think your text book does not talk about this one? FWIW try this now ... int main(void) { struct myStruct { .. . myStruct myS1, myS2; for ( int i = 0; i < 256; ++i ) { ... myS1 = myS2; for ( int i = 0; i < 256; ++i) { ... return 0; ... In C when you assign a structure to another, it is nothing more that plain bit by bit copy. HTH -- Imanpreet Singh Arora [EMAIL PROTECTED] Remove Z to mail "Things may come to those who wait, but only the things left by those who. .. - Tues, Oct 12 2004 10:56 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/6f328426ee192ea8 flush(stdin) - 2 new ---------------------------------- ... As others have pointed out, fflush behavior is only defined when working on output streams. Funny thing is, I had this same book on my bookshelf ( don't remember where it came from, never really used it before), picked it up to look something up just the other day, and opened it up to the page with the above example. For some reason it caught my eye and when I realized what what going on I decided maybe I should not look for my answer in this book. It is no longer on my bookshelf. Cursory examination reveals other... - Tues, Oct 12 2004 11:44 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/8f28b1d71eb15357 list view control - 3 new ---------------------------------- Hi I'm programming with C in win32 using Dev C++. I have created a list-view control and can display it on a modeless dialog box. but i cannot figure out how to add a header. can anyone help. I've already looked at msdn and found all of their documentaion, but it is so confusing and i'm not sure if it works with dev C++ due to the fact that most of it is for Visual Basic. source code would be great! Thanks for any help! ... - Tues, Oct 12 2004 1:58 pm 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/7a465dabdfb6cc87 gcc in linux - 5 new ---------------------------------- Hi again, I am new to compiling C programs in Linux/Unix. I wanted to compile a program by using gcc, but it turned out that gcc does not know where to locate the library being called. The program is as follows, ... { double ss; double ff; ss=1.0; ff=sin(ss); printf("%6.4f\n",ff); return 0; ... The error message is, /tmp/ccIV3yAb.o: In function `main': /tmp/ccIV3yAb.o(.text+0x1e): undefined reference to `sin' The command I used to compile is gcc test.c Could anyone please let me know where I did wrong? Thanks! Fan... - Tues, Oct 12 2004 3:25 pm 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/37104369ff029628 #define and external static - 4 new ---------------------------------- Hi group, This is a follow-up of the question I posted this afternoon. I tried to define two constants, PI and radian in that program in the following way, ... I wonder whether they are the same as static double PI=3.1415926; static double radian=180./PI; If they are not, why? Thanks! Regards, Fan . .. - Tues, Oct 12 2004 3:17 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/4bdfd8881444bcd5 lcc-win32 - 4 new ---------------------------------- On Mon, 11 Oct 2004 21:56:37 +0200, in comp.lang.c , jacob navia ... Sure, that'll remove the names, and with a badly optimised compiler it'll reduce the link size. But the size of the implementation on disk isn't affected. ... Then propose one to comp.std.c, and see how you get on ... This thread aside, this is not an FAQ so it has little or no place in the FAQ. ... - Tues, Oct 12 2004 3:29 pm 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/60059ee1489ebe79 Off Topic: Why is stdprn not defined under Windows? - 3 new ---------------------------------- ... They match good. N869 ...... - Tues, Oct 12 2004 5:03 pm 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/40b707dad6259a20 Global variable declaration in headers - all new ---------------------------------- ... I don't understand how that header file is used, and how there would be a benefit from having a static object declaration in it. What would a program that used it, be like? Which C files would include it, in a program? How many C files would there be in a program which used it. ... - Tues, Oct 12 2004 4:00 pm 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/29565adb8756b59c can strftime() product non-locale specific (i.e. UTC) results? - 2 new ---------------------------------- ... No; the definition of strftime() in the Standard demands that it uses the current locale. However, you can try to - use setlocale(LC_TIME, 0) to determine the current locale, then either; - use setlocale(LC_TIME, "C") to set the locale to the default "C" locale, or - use setlocale(LC_TIME, "UTC") to attempt to set the time locale to UTC (or whatever other value happens to work for you), then - use strftime(), then - use setlocale(LC_TIME, saved_ value) to set the locale back. Unfortunately, you can _try_ doing this, but... - Wed, Oct 13 2004 12:59 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/fd42988274002978 Why 'sizof (CBuffer::m_pData)' doesn't work ? - 2 new ---------------------------------- ... Ok ok ok ... I knew I might overlook something when I posted to c.l.c. However if I have this declaration: struct CBuffer { unsigned char *m_ pData; size_t m_nSize; ... how should I get the sizeof (*(struct CBuffer *)main).m_pData in a way that many could say it is nicer ? (this code really compiles in C, I've tested) P. S. How come c.l.c has far more messages than c.l.c++ ? Thank you Timothy Madden Romania ... ... - Wed, Oct 13 2004 1:47 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/820043448c31f7a4 bit masking - 3 new ---------------------------------- ... [ Please do not snip all references from a follow-up. Snip only those references for which you also remove the quoted text. ] ... I don't give a damn how much you paid; the contents is the only thing I care about. ... And yes, this was conforming, as you'd have immediately realised if you'd completely read my post you quote above. As I said, K&R was written _before_ 1999. Therefore, it uses C89, and in C89 that code is conforming. If you insist on a book that uses C99, I suggest you look at its publication date before shelling out your... - Wed, Oct 13 2004 1:21 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/9466a48fca0d94ad how much of C is enough? - 4 new ---------------------------------- Hello friends, Sorry if u find my post somewhat lenghty . I m 29 , and have taken up a 3 years course in computer science , and i love C for arts' sake. ... book i find some new and intersting point.But my problem is I just seem to be learning the LANGUAGE and not PROGRAMMING. At moment, i came to know that C language and C compiler are different things, and undefined behavior Vs unspecified behavior , and stuff like sequence point.I have some doubts and i will be very grateful if someone really helps me.My problems are.. ... - Wed, Oct 13 2004 7:03 am 4 messages, 4 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/46cc1ae858060d89 K&R 1.5.1 exercise - 3 new ---------------------------------- ... I have already explained you *exactly* what this program does. The behaviour is less than obvious when stdin is connected to a terminal because the getchar() call won't return until the user presses the Return/Enter key ( on some platforms it may return as soon as the eof key is pressed). Once the user has pressed the Return key, the program will display a 1 or a 0, depending on what was the first key pressed by the user. fangorn:~/tmp 206> cat test.c ... int main(int orange, char **mango) {... - Wed, Oct 13 2004 9:07 am 3 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f77b20dad505718c Scan input - But only if something has been typed - 3 new ---------------------------------- Hello all, I would like to do a simple input scan from the command line, but only if the user has typed something... I have had a look at the select() method, but am still having trouble. Basically, I want to treat stdin as a textField. Having a GUI would solve this problem of course, but a gui is not required, and I'm after an easier way. Ta Chris ... - Wed, Oct 13 2004 6:30 am 3 messages, 3 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/f18066636f672c1c authentication - all new ---------------------------------- ... In group(s) dealing with the operating system(s) of interest. Alex ... - Wed, Oct 13 2004 6:13 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/3c3c91d316b2f237 malloc and free - all new ---------------------------------- Hi, When free() is used to free the memory allocated by malloc(), how does it know the size of the memory to be freed? I guess I'm asking where does the info stored? Thanks Ed ... - Wed, Oct 13 2004 9:18 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/47993895d01f543f Variable size arrays and pointers - all new ---------------------------------- ... ... - Wed, Oct 13 2004 8:03 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/71085f5257222ef7 How to retrieve the name of the file from a FILE * - 2 new ---------------------------------- ... If it's not portable, you're abusing this newsgroup by advertising it. If it's portable, my congratulations! Dan... - Wed, Oct 13 2004 6:55 am 2 messages, 2 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/301e181597d2c4fa arbitrary array index range? - 5 new ---------------------------------- "A Book on C" explains a technique to use an arbitrary array index range. int* p = malloc(sizeof(int) * 10) - 1; This way, the allocated array can be accessed with index range 1 ~ 10, not 0 ~ 9. You cannot use p[0], of course, and the memory should be released with free(p + 1). It worked with gcc and MSVC, but I'm not sure if it makes sense to take the address before the initial element of an array. Does anyone have any definite answer? ... - Wed, Oct 13 2004 7:33 am 5 messages, 5 authors http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/ace3b99f14b1bc78 cmsg cancel <[EMAIL PROTECTED]> - all new ---------------------------------- This message was cancelled by Default User Original message header: From: "Default User" Subject:Re: malloc and free Date:Thu, 14 Oct 2004 13:01:04 -0500 Newsgroups:comp.lang.c Message-ID: ... - Thurs, Oct 14 2004 11:08 am 1 message, 1 author http://groups-beta.google.com/group/comp.lang.c/browse_thread/thread/e5421e1d0c5d7398 ======================================================================= 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
