[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #56 from Denis Kolesnik --- it is a bug and if it is related to DMZ so as I think I will not do any diplomacy on it.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #55 from Andrew Pinski --- Seriously this bug report is out of hand. First let me say this: what do you think GCC is doing wrong? If you want report a new bug as this bug is full of many different bugs in your code; don't reopen this bug. Please when you open a new one explain what you think GCC is doing wrong and provide all the needed data files (which you are missing right now). Second the library functions like fopen and fgetc are not provided by GCC but by your libc vendor (in the case of mingw, mingw and to some extend even Microsoft). So if this code is not working due to fopen/fgetc then it is not a bug in GCC. Note I see at least one bug in your code, fgetc returns an int type and EOF is -1 in int as 0xff is a valid character (not in UTF-8 though). It might be the cause of the bug in the first place.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #54 from Denis Kolesnik --- please do not close this issue untill I will have the abilitz to prove whether it is a bug or not.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #53 from Denis Kolesnik --- I will try to not such google services, because I'm not sure that my conditions will be respected and I will search guaranties. But while a character is 8bit what does it change? All russian letters, that are used in current russian language are coded in the similar maner?!
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #52 from Andrew Pinski --- I think you will find that you need to open the file in binary mode and that might help you out. And that the char is 8bit characters so the you need to look up the encoding format for UTF-8.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #51 from Denis Kolesnik --- I will set as unconfirmed each time it will be changed, because I have no ability to download from internet the version 4.6.1 from MinGW official source(and the version I have now on my DVD could be contaminated with a virus). Maybe you are right and there is no bug. I could make diplomacy even if there is a bug but not in key questions of my politic views. You also should acknowledge your mistakes. I do if I'm wrong, why you do not do the same? It does not makes you bad, just shows you, that you should work on yourself as I do and I do a lot of mistakes, which I acknowledge. Sorry also for uncensored words, but if you will demand I will search something that is unspoken now... There is a version 4.6.1 from google, I will try it now and if there is no bug I resolve this as invalid, but again not to forget about my key views.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #50 from Denis Kolesnik --- listen if you will not stop to fool me I wil act immediatelly by pointing each your step on a illustrated map!
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #49 from Denis Kolesnik --- And do not try to lie for 4.6.1 version when I download it again. I do pay taxes regularly and even more, so do not put me into criminal world.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #48 from Denis Kolesnik --- sorry wrote false. Here I corrected: it is correct because it works with every letter of russian alphabeth in that codepage except with small "ya"(which corresponds to U+044F in Unicode). It replaces only "A", "a", "E", "e" letters and russian both big and small U+0415 / U+0435, U+0410 / U+0430. If I will find provement of intrusion into my PC by such people like you I will not let it be so. I believe in USSR Police which worked perfectly and catched such people like you and I'm very glad it is so. You started with emotions and I answered with emotions.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #47 from Denis Kolesnik --- sorry wrote false. Here I corrected: it is correct because it works with every letter of russian alphabeth in that codepage except with small "ya"(which corresponds to U+044F in Unicode). It replaces only "A", "a", "E", "e" letters and russian both big ans small U+0415 / U+0435, U+0410 / U+0430. If I will find provement of intrusion into my PC by such people like you I will not let it be so. I believe in USSR Police which worked perfectly and catched such people like you and I'm very glad it is so. You started with emotions and I answered with emotions.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #46 from Denis Kolesnik --- http://en.wikipedia.org/wiki/Russian_alphabet it is correct because it works with every letter of russian alphabeth in that codepage except with small "ya"(which corresponds to U+044F in Unicode). It replaces only "A", "a"(U+0410 / U+0430), "E", "e"(U+0415 / U+0435) letters and russian both big ans small "Ye", "a". If I will find provement of intrusion into my PC by such people like you I will not let it be so. I believe in USSR Police which worked perfectly and catched such people like you and I'm very glad it is so. You started with emotions and I answered with emotions.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #45 from Denis Kolesnik --- Listen, you, Afroruspoetry ASP, stop annoying me, I tested it twice. This is not the place to teach me how to behave!
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #44 from Jonathan Wakely --- Noone said to reinstall your computer. Noone here is trying to attack your computer. Your program is not correct, that's why it doesn't work. The problem is not with GCC. Now please go away.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #43 from Denis Kolesnik --- you guys yourself have bad culture if you tell me this is not the place to talk about my not working correctly compiler, but yourself talk about meat.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #42 from Denis Kolesnik --- do not even try to intrude my pc remotelly!
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #41 from Denis Kolesnik --- spam? where do you see meat here?
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Andreas Schwab changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #40 from Andreas Schwab --- spam.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #39 from Denis Kolesnik --- Dear Mr. Wakely, if people like you plan to make court of my money by some actions I better minimize my contacts with people like you, because after I did reinstall my system I have the same problem again. --
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #38 from Denis Kolesnik --- if i find a bug I will reopen it and if I find intrusion in my software I will take actions accordingly.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #37 from Denis Kolesnik --- you are not right in the following: I did not visit sites where would be fair to contaminate my software with viruses and similar code and I do trust(not fully, but enough) to Microsoft support because of their reputation. And Microsoft claims to defend of such problems. Did I wrote here something wrong? Wait I will check now again after I did reinstall my system. I do not think, that I'm wrong here and that my guilt in this problems is most.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID Severity|major |normal --- Comment #36 from Jonathan Wakely --- GCC's Bugzilla is not here to debug your programs, please stop re-opening this. Try posting your code at stackoverflow.com instead where someone might be willing and able to tell you what's wrong, but you will need to say more than "it works".
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Severity|blocker |major
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #35 from Denis Kolesnik --- it works with every russian letter except small letter "ya", I consider it as a bug.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #34 from Denis Kolesnik --- // a small text file filter.c // #include main(int argc, char* argv[]) { char c, previous_c; int word_begin_position[3000]; //int spec_symbol[7]={0xAE,0xBB,0xAB,0xA9,0x22,0x2F,0x27}; //int eof_symbol[2]={0x0D,0x0A}; int search_result; int this_is_the_same_word; int words_count; int word_number; int search_result_A_count; int search_result_space; FILE *stream,*stream2; int i, j, characters_count, character_number; int other_character_printed; // double characters int A_count, E_count; characters_count=0; stream = fopen (argv[1],"r"); while ((c = fgetc(stream)) != EOF) { characters_count++; } fclose(stream); //printf("total characters are %i\n", characters_count); character_number=1; words_count=0; previous_c=0; stream = fopen (argv[1],"r"); while ((c = fgetc(stream)) != EOF) { if(((c!=0x20) && (character_number==1)) || ((previous_c==0x20) && (c!=0x20) && (c!=0x0A)) || ((previous_c!=0x20) && (c==0x0D)) || ((c!=0x20) && (c!=0x0D) && (c!=0x0A) && (previous_c==0x0A)) || ((previous_c!=0x20) && (previous_c!=0x0A) && (character_number==characters_count) && (c==0x20))) //1. ((c!=0x20) && (character_number==1)) //2. ((previous_c==0x20) && (c!=0x20) && (c!=0x0A)) //3. ((previous_c!=0x20) && (c==0x0D)) //!((previous_c!=0x0D) && (c==0x0A)) //4. ((c!=0x20) && (c!=0x0D) && (c!=0x0A) && (previous_c==0x0A)) //5. ((previous_c!=0x20) && (previous_c!=0x0A) && (character_number==characters_count) && (c==0x20)) this_is_the_same_word=0; else this_is_the_same_word=1; if(this_is_the_same_word==0) { words_count++; word_begin_position[words_count]=character_number; //printf(" the begin char is . %i",word_begin_position[words_count]); } //if(character_number==characters_count) //printf("the last character"); /* printf(" the number of words is %i\n", words_count); printf(" the current character is . %c\n", c); if(c==0x0D) printf(" the current character is . 0x0D\n"); if(c==0x0A) printf(" the current character is . 0x0A\n"); */ previous_c=c; character_number++; } fclose(stream); word_number=1; character_number=1; A_count=1; E_count=1; stream = fopen (argv[1],"r"); //stream2 = fopen (argv[2],"w"); while ((c = fgetc(stream)) != EOF) { other_character_printed=0; if(words_count>=2) if(word_number= word_begin_position[word_number]) && (character_number < word_begin_position[word_number+1])) { A_count=1; E_count=1; word_number++; } //printf("\n the word begin position %i\n",word_begin_position[word_number]); //printf("\n1 char is %i\n", character_number); //printf("\nthe words count is %i\n", words_count); // A if((other_character_printed==0) && ((c=='a') || (c=='а') || (c=='A') || (c=='А')) ) if(A_count==1) { printf("A1"); A_count=2; other_character_printed=1; } else { printf("A2"); A_count=1; other_character_printed=1; } else if((other_character_printed==0) && ((c!='е') && (c!='e') && (c!='Е') && (c!='E'))) { printf("%c", c); other_character_printed=1; } // E if((other_character_printed==0) && ((c=='e') || (c=='е') || (c=='E') || (c=='Е')) ) if(E_count==1) { printf("E1"); E_count=2; other_character_printed=1; } else { printf("E2"); E_count=1; other_character_printed=1; } else if((other_character_printed==0) && ((c!='a') && (c!='а') && (c!='А') && (c!='A'))) { printf("%c", c); other_character_printed=1; } //if(c=='0') //{ //printf("%c", c); //other_character_printed=1; //} character_number++; } fclose(stream); //printf(" the number of words is %i", words_count); return 0; }
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #33 from Denis Kolesnik --- I found where an error in my code, corrected it and till yet it functions normally. Sorry for my misunderstanding. On alone I could not find an error in my code. I know, that you say it is not the place to report a bug, but I was sure my code is correct.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Kai Tietz changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #32 from Kai Tietz --- (In reply to Denis Kolesnik from comment #29) > My code style has nothing to do with it. I even do not tell, that I do not > fully like the interface of this site!! Well, you coding-style and ability is poor. Believe me. I wasn't referring to those none-used arrays. Think about this if-line in your second sample. It contains the out of bounds access: ... if((character_number >= word_begin_position[word_number]) && (character_number <= word_begin_position[word_number+1]) ) ... What is word_begin_position[word_number+1]??? Imagine you are within the final word in your file. The value at this position isn't initialized and therefore contains random number. Btw here in this line is also one of the logical failures you made. Why your if-condition includes first character of next word? So you mights see, or I fear you won't, that your program has more then one bug and therefore this is a invalid bug-report of gcc.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #31 from Denis Kolesnik --- Your arguments are based on what?? I argued my arguments!
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #30 from Denis Kolesnik --- I use the elements of the array fully correct:> int word_begin_position[3000];
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #29 from Denis Kolesnik --- My code style has nothing to do with it. I even do not tell, that I do not fully like the interface of this site!!
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|WONTFIX |--- --- Comment #28 from Denis Kolesnik --- commenting gives no change:> //int spec_symbol[7]={0xAE,0xBB,0xAB,0xA9,0x22,0x2F,0x27}; //int eof_symbol[2]={0x0D,0x0A}; other the only one array is declared fully correct as stated at "C How to Program" H.M. Deitel Nove University Deitel and Associates P. J. Deitel Deitel Associates
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #24 from Denis Kolesnik --- Mister, I have had tragedies in my life, that is why I do not want to make politica with all. It is a bug and I described why.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #26 from Denis Kolesnik --- My code has no errors. It is a bug.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Kai Tietz changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #25 from Kai Tietz --- It is none.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Kai Tietz changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |WONTFIX --- Comment #27 from Kai Tietz --- .
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Kai Tietz changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED CC||ktietz at gcc dot gnu.org Resolution|--- |INVALID --- Comment #23 from Kai Tietz --- First, don't be so self-righteous. Your program has more then one bug ... for sure you need to learn this language better ... within this code there are at least two major logical failures, and one serious array out-of-bounds access on uninitialized data, and your coding-style is simply poor. The C language isn't Lisp, you don't need that much frames, neither you don't need to repeat within on logical expression the prior expression ... it just makes code unreadable ... anyway I won't tell you your bugs, as I am assuming your are a rooky student trying to learn C and I don't want to destroy the sense of your teachers lesson. So I close this bug as invalid, as it is ...
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #22 from Denis Kolesnik --- I know that this is not a place to report programming problems, but I do not see errors in my code
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #21 from Denis Kolesnik --- Even all characters, which are numeric are processed except '0'. This is a bug! I do not violate eny C++ rules and I do not receive even any messages while compilation. This is a bug. You can not hide the truth!
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #20 from Denis Kolesnik --- '0' is not 'a' in 2 languages and not 'e' in 2 languages in both: small or capital variants
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #19 from Denis Kolesnik --- I do not have errors in my core: other characters processed except '0'. This is a bug!
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #18 from Andrew Pinski --- Again this is not a place to learn c programming or get help to debug your code. This is a place to report bugs against GCC and I don't see a bug here. There are other places on the internet to get c programming help.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #17 from Denis Kolesnik --- please specify the reason for your demand? I can not see anything I missed in my code!!
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Andreas Schwab changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #16 from Andreas Schwab --- We are not going to debug your code.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #15 from Denis Kolesnik --- the output line is:> A1RSE1NA2LE2 212 A1 should be:> A1RSE1NA2LE2 2012 A1
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #14 from Denis Kolesnik --- In the following code:> // a small text file filter.c // #include main(int argc, char* argv[]) { char c, previous_c; int word_begin_position[3000]; int spec_symbol[7]={0xAE,0xBB,0xAB,0xA9,0x22,0x2F,0x27}; int eof_symbol[2]={0x0D,0x0A}; int search_result; int this_is_the_same_word; int words_count; int word_number; int search_result_A_count; int search_result_space; FILE *stream,*stream2; int i, j, characters_count, character_number; int other_character_printed; // double characters int A_count, E_count; characters_count=0; stream = fopen (argv[1],"r"); while ((c = fgetc(stream)) != EOF) { characters_count++; } fclose(stream); //printf("total characters are %i\n", characters_count); character_number=1; words_count=0; previous_c=0; stream = fopen (argv[1],"r"); while ((c = fgetc(stream)) != EOF) { if(((c!=0x20) && (character_number==1)) || ((previous_c==0x20) && (c!=0x20) && (c!=0x0A)) || ((previous_c!=0x20) && (c==0x0D)) || ((c!=0x20) && (c!=0x0D) && (c!=0x0A) && (previous_c==0x0A)) || ((previous_c!=0x20) && (previous_c!=0x0A) && (character_number==characters_count) && (c==0x20))) //1. ((c!=0x20) && (character_number==1)) //2. ((previous_c==0x20) && (c!=0x20) && (c!=0x0A)) //3. ((previous_c!=0x20) && (c==0x0D)) //!((previous_c!=0x0D) && (c==0x0A)) //4. ((c!=0x20) && (c!=0x0D) && (c!=0x0A) && (previous_c==0x0A)) //5. ((previous_c!=0x20) && (previous_c!=0x0A) && (character_number==characters_count) && (c==0x20)) this_is_the_same_word=0; else this_is_the_same_word=1; if(this_is_the_same_word==0) { words_count++; word_begin_position[words_count]=character_number; //printf(" the begin char is . %i",word_begin_position[words_count]); } //if(character_number==characters_count) //printf("the last character"); /* printf(" the number of words is %i\n", words_count); printf(" the current character is . %c\n", c); if(c==0x0D) printf(" the current character is . 0x0D\n"); if(c==0x0A) printf(" the current character is . 0x0A\n"); */ previous_c=c; character_number++; } fclose(stream); word_number=1; character_number=1; A_count=1; E_count=1; stream = fopen (argv[1],"r"); //stream2 = fopen (argv[2],"w"); while ((c = fgetc(stream)) != EOF) { other_character_printed=0; if((character_number >= word_begin_position[word_number]) && (character_number <= word_begin_position[word_number+1]) ) { if(((c=='a') || (c=='а') || (c=='A') || (c=='А')) ) { if(A_count==1) { printf("A1"); A_count=2; other_character_printed=1; } else { printf("A2"); A_count=1; other_character_printed=1; } } else if((other_character_printed==0) && ((c!='е') && (c!='e') && (c!='Е') && (c!='E'))) { printf("%c", c); other_character_printed=1; } if((c=='e') || (c=='е') || (c=='Е') || (c=='E')) { if(E_count==1) { printf("E1"); E_count=2; other_character_printed=1; } else { printf("E2"); E_count=1; other_character_printed=1; } } else if((other_character_printed==0) && (((c=='a') & (c=='а') && (c=='A') && (c=='А' { printf("%c", c); other_character_printed=1; } } else { A_count=1; E_count=1; word_number++; } character_number++; } fclose(stream); //printf(" the number of words is %i", words_count); return 0; } why other characters representing number are displayed to the screen except "0"? when the input text file is of the cintent: ARSeNALE 2012 ARSENALE It is a bug and nothing else! Nowhere in my code is stated to ignore "0" --
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #13 from Denis Kolesnik --- (In reply to Andrew Pinski from comment #12) > You want %c. This is not the correct place to ask questions about C > programming. This is a place to report bugs in GCC. :> thanks for help
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #12 from Andrew Pinski --- You want %c. This is not the correct place to ask questions about C programming. This is a place to report bugs in GCC.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #11 from Denis Kolesnik --- why in this code:> // a small text file filter.c // #include main(int argc, char* argv[]) { char c, previous_c; int word_begin_position[3000]; int spec_symbol[7]={0xAE,0xBB,0xAB,0xA9,0x22,0x2F,0x27}; int eof_symbol[2]={0x0D,0x0A}; int search_result; int this_is_the_same_word; int words_count; int word_number; int search_result_A_count; int search_result_space; FILE *stream,*stream2; int i, j, characters_count, character_number; characters_count=0; stream = fopen (argv[1],"r"); while ((c = fgetc(stream)) != EOF) { characters_count++; } fclose(stream); //printf("total characters are %i\n", characters_count); character_number=1; words_count=0; previous_c=0; stream = fopen (argv[1],"r"); while ((c = fgetc(stream)) != EOF) { if(((c!=0x20) && (character_number==1)) || ((previous_c==0x20) && (c!=0x20) && (c!=0x0A)) || ((previous_c!=0x20) && (c==0x0D)) || ((c!=0x20) && (c!=0x0D) && (c!=0x0A) && (previous_c==0x0A)) || ((previous_c!=0x20) && (previous_c!=0x0A) && (character_number==characters_count) && (c==0x20))) //1. ((c!=0x20) && (character_number==1)) //2. ((previous_c==0x20) && (c!=0x20) && (c!=0x0A)) //3. ((previous_c!=0x20) && (c==0x0D)) //!((previous_c!=0x0D) && (c==0x0A)) //4. ((c!=0x20) && (c!=0x0D) && (c!=0x0A) && (previous_c==0x0A)) //5. ((previous_c!=0x20) && (previous_c!=0x0A) && (character_number==characters_count) && (c==0x20)) this_is_the_same_word=0; else this_is_the_same_word=1; if(this_is_the_same_word==0) { words_count++; word_begin_position[words_count]=character_number; //printf(" the begin char is . %i",word_begin_position[words_count]); } //if(character_number==characters_count) //printf("the last character"); /* printf(" the number of words is %i\n", words_count); printf(" the current character is . %c\n", c); if(c==0x0D) printf(" the current character is . 0x0D\n"); if(c==0x0A) printf(" the current character is . 0x0A\n"); */ previous_c=c; character_number++; } fclose(stream); word_number=1; character_number=1; stream = fopen (argv[1],"r"); //stream2 = fopen (argv[2],"w"); while ((c = fgetc(stream)) != EOF) { if((character_number >= word_begin_position[word_number]) && (character_number <= word_begin_position[word_number+1])) { if(c==0x0D) printf("A"); else printf("%s", c); } //else //word_number++; character_number++; } fclose(stream); //printf(" the number of words is %i", words_count); return 0; } the portion:> if(c==0x0D) printf("A"); else printf("%s", c); results in error while program run??
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #10 from Denis Kolesnik --- :> the "then" is obivious,
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #8 from Denis Kolesnik --- I found my mistake
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Resolution|FIXED |INVALID --- Comment #9 from Denis Kolesnik --- I found my mistake
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #7 from Denis Kolesnik --- I found my error, sorry for it.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Denis Kolesnik changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #6 from Denis Kolesnik --- please tell me where in this corrected code I made mistake:> // a small text file filter.c // #include main(int argc, char* argv[]) { char c, previous_c; int word_begin_position[3000]; int spec_symbol[7]={0xAE,0xBB,0xAB,0xA9,0x22,0x2F,0x27}; int eof_symbol[2]={0x0D,0x0A}; int search_result; int this_is_the_same_word; int words_count; int word_number; int search_result_A_count; int search_result_space; FILE *stream,*stream2; int i, j, characters_count, character_number; characters_count=0; stream = fopen (argv[1],"r"); while ((c = fgetc(stream)) != EOF) { characters_count++; } fclose(stream); //printf("total characters are %i\n", characters_count); character_number=1; words_count=0; previous_c=0; stream = fopen (argv[1],"r"); while ((c = fgetc(stream)) != EOF) { if(((c!=0x20) && (character_number==1)) || ((previous_c==0x20) && (c!=0x20) && (c!=0x0A)) || ((previous_c!=0x20) && (c==0x0D)) || ((c!=0x20) && (c!=0x0D) && (c!=0x0A) && (previous_c==0x0A)) || ((previous_c!=0x20) && (previous_c!=0x0A) && (character_number==characters_count) && (c==0x20))) //1. ((c!=0x20) && (character_number==1)) //2. ((previous_c==0x20) && (c!=0x20) && (c!=0x0A)) //3. ((previous_c!=0x20) && (c==0x0D)) //!((previous_c!=0x0D) && (c==0x0A)) //4. ((c!=0x20) && (c!=0x0D) && (c!=0x0A) && (previous_c==0x0A)) //5. ((previous_c!=0x20) && (previous_c!=0x0A) && (character_number==characters_count) && (c==0x20)) this_is_the_same_word=0; else this_is_the_same_word=1; if(this_is_the_same_word==0) { words_count++; word_begin_position[words_count]=character_number; //printf(" the begin char is . %i",word_begin_position[words_count]); } //if(character_number==characters_count) //printf("the last character"); /* printf(" the number of words is %i\n", words_count); printf(" the current character is . %c\n", c); if(c==0x0D) printf(" the current character is . 0x0D\n"); if(c==0x0A) printf(" the current character is . 0x0A\n"); */ previous_c=c; character_number++; } fclose(stream); word_number=1; character_number=1; stream = fopen (argv[1],"r"); //stream2 = fopen (argv[2],"w"); while ((c = fgetc(stream)) != EOF) { //if((character_number >= word_begin_position[word_number]) && (character_number <= word_begin_position[word_number+1])) if(c==0x0D) then { //fprintf(stream2,"%s", "\\r\\n"); //if(c==EOF) //then //printf("A"); //else //printf("%s",c); printf("%s", c); } //else //word_number++; character_number++; } fclose(stream); //printf(" the number of words is %i", words_count); return 0; } why this portion of code:> if(c==0x0D) then { //fprintf(stream2,"%s", "\\r\\n"); //if(c==EOF) //then //printf("A"); //else //printf("%s",c); printf("%s", c); } //else //word_number++; reports:> replace_1.c: In function 'main': replace_1.c:112:3: error: 'then' undeclared (first use in this function) replace_1.c:112:3: note: each undeclared identifier is reported only once for ea ch function it appears in replace_1.c:113:3: error: expected ';' before '{' token
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #5 from Denis Kolesnik --- thanks my mind possibly poisoned by some mushrooms(not by me), that is why I do not notice such simple things and can not find it.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #4 from Denis Kolesnik --- MY OS is MS Windows 8.1 64x licensed
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Andrew Pinski --- With -W -Wall you get some warnings which expose what is going wrong: t.c: In function ‘main’: t.c:46: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’ t.c:49: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’ Using %d instead works.
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #2 from Denis Kolesnik --- echo off PATH=%PATH%;c:\MinGW\bin;C:\MinGW\x86_64-w64-mingw32\bin set application_file=main_app2 gcc replace_1.c
[Bug c++/59598] very simple code using file open for read
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59598 --- Comment #1 from Denis Kolesnik --- Created attachment 31512 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31512&action=edit C++ source file