Compare 2 files in c




















Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Comparing two files in c [closed] Ask Question. Asked 8 years, 10 months ago. Active 8 years, 9 months ago. Viewed 15k times. Lind Lind 2 2 gold badges 5 5 silver badges 15 15 bronze badges. A don't send error? Compile with all warnings and debugging information e. For starters, I'd be looking at where you assign strings to s1 and s2.

What's wrong with 2 fgets and a strcmp in a while loop? Also consider what will happen if your file either ends in a single line-feed, or a line which is not terminated with a line-feed Show 3 more comments. Active Oldest Votes. By the way, strcmp returns zero if the two strings are the same, non-zero if they are different. Add a comment. You also don't reset p1 and p2 after each line. Thanks thats what I needed. I know that if a line is bigger than it will cause an error,I just wanted to test the code with less lines as for now.

It's not "lazy evaluation" and it's not "at least with gcc and on my system". It's defined in the language; it's always. We are given almost two identical files. But some characters are corrupted. We need to find the line number and their position where those corrupted letter exists as well as Total number of corrupted error letters.

Examples: Input : file1. Prerequisite : getc in C Steps : 1. Skip to content. Change Language. Related Articles. Table of Contents. Improve Article. Save Article. Like Article. Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more!



0コメント

  • 1000 / 1000