File editing - error reading/writing %

This is a discussion on File editing - error reading/writing % within the C Programming forums, part of the General Programming Boards category; Please pretend I never made any post here!! Woke up this morning and realised just how stupid a mistake I ...

  1. #1
    Goscinny or Uderzo?
    Join Date
    Jun 2004
    Posts
    33

    File editing - error reading/writing %

    Please pretend I never made any post here!! Woke up this morning and realised just how stupid a mistake I was making. That's what I get for over-thinking the problem for too long!!
    Last edited by Tankndozer; 07-06-2004 at 01:45 AM.

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    when using printf() family you need to use "%%" to print out one % symbol

  3. #3
    Goscinny or Uderzo?
    Join Date
    Jun 2004
    Posts
    33

    Smile

    Quote Originally Posted by Thantos
    when using printf() family you need to use "%%" to print out one % symbol
    Thanks Thantos. I figured it might be something like that but I've never seen % listed as a special char before. If I have I don't remember it- quite possible seeing as I'm only relearning C. I've had to use FORTRAN for the last few years for scientific computing... ugh!

  4. #4
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    In printf( ), the "%" symbol is used for including other data types in a string.

    eg printf( "x=%d", 5 ) would print out "x=5". There's a lot of other options, which you can look up here.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  2. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  3. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  5. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 09:57 AM

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