Thread: hopefully a simple oversight

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    13

    hopefully a simple oversight

    Why isn't this working?

    All I want to do is take a character from one text file and copy it in a new text file...

    Code:
    int main(){
    
    #include <stdio.h>
    
    FILE *tf = fopen("./map", "r");
    FILE *af = fopen("./array", "w");
    unsigned char x;
    
    while  ( ( x = fgetc( tf ) ) != EOF )
       {
              fprintf( af, "%c", x);
        }
    
    
    return 0;
    }
    But I get the following warning on the while loop, and of course, an endless loop:



    reader.c: In function `main':
    reader.c:9: warning: comparison is always true due to limited range of data type
    Last edited by dopejack; 10-16-2006 at 07:46 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating very simple text editor using c
    By if13121 in forum C Programming
    Replies: 9
    Last Post: 10-19-2010, 05:26 PM
  2. Simple message encryption
    By Vicious in forum C++ Programming
    Replies: 10
    Last Post: 11-07-2004, 11:48 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Simple simple program
    By Ryback in forum C++ Programming
    Replies: 10
    Last Post: 09-09-2004, 05:48 AM
  5. Need help with simple DAQ program
    By canada-paul in forum C++ Programming
    Replies: 12
    Last Post: 03-15-2002, 08:52 AM