PRINTF problem

This is a discussion on PRINTF problem within the Linux Programming forums, part of the Platform Specific Boards category; Hey. Im writing a chat program that uses threads and continuelly reads from a text file to compare messages and ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    47

    PRINTF problem

    Hey. Im writing a chat program that uses threads and continuelly reads from a text file to compare messages and refresh yours. I use the command

    printf("%s\n",buffer);
    the \n is telling it to go to next line so that when it refreshes again it will print on a new line. But rather than printing at the beginning of line on the next line it prints it where it left off on the line before but on the next line down. any ideas of what is wrong?

  2. #2
    Registered User quagsire's Avatar
    Join Date
    Jun 2002
    Posts
    60
    printf("%s\n\r",buffer);

    The \r are for carriage return and the \n for newline

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems reading entered race times C
    By loopymoo26 in forum C Programming
    Replies: 12
    Last Post: 05-23-2009, 08:38 AM
  2. Help with a C Programing Quiz project
    By dilemma in forum C Programming
    Replies: 12
    Last Post: 05-15-2009, 04:35 PM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  4. error in program????
    By SpEkTrE in forum C Programming
    Replies: 5
    Last Post: 11-24-2003, 06:16 PM
  5. Drawing tables in C
    By stanoman in forum C Programming
    Replies: 5
    Last Post: 10-09-2003, 11:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21