![]() | |||||||||||||
Messages in this thread |
[ Please don't Cc: me when replying to my message on a mailing list. ] Russell Berry: > Okay, that's enough of that, Here is ANSI C Paragraph 7.9.10.2 Please also read 7.9.1 (description of FILE), 7.9.3 (last sentence in first paragraph), and 7.9.7.1 (fgetc). See also the C FAQ at <URL:http://www.eskimo.com/~scs/C-faq/top.html>; all of it. You don't use feof to predict whether the next read will hit end-of-file; you use it to see whether a previous operation already did hit end-of-file. Your program was, essentially: > color=fopen("XColor.java","w+"); > while(!feof(rgb)){ > fscanf(rgb,"%d%d%d%s",&r,&g,&b,cname); > fprintf(color," ////////////////////\n"); > fprintf(color," // The color %s\n",cname); > fprintf(color," ////////////////////\n\n"); > fprintf(color," public final static Color %s = new\ > Color(%d, %d, %d);\n\n",cname,r,g,b); > } You are calling feof to see whether the fscanf will succeed. That is wrong. You have an infinite loop because for some reason fscanf never sets the end-of-file indicator. This is almost certainly because your input file doesn't match the fscanf pattern. I seriously doubt it is because fscanf or feof is buggy. If you think they are, take the thread to linux-gcc, or comp.os.linux.development.system, and provide the problematic input file (a couple of lines is enough), and version numbers for all relevant parts of the software. This really isn't on-topic for linux-kernel. Oh, and publishing private e-mail is quite rude, thank you very much. -- Please read <http://www.iki.fi/liw/mail-to-lasu.html> before mailing me. Please don't Cc: me when replying to my message on a mailing list. [unhandled content-type:application/pgp-signature] | ||||||||||||
| Last update: 2005-03-22 13:39 [W:0.457 / U:0.060 seconds] ©2003-2008 Jasper Spaans | |||||||||||||