Reading in a text file

This is a discussion on Reading in a text file within the C Programming forums, part of the General Programming Boards category; I am creating a program where I have to rotate an image 90', 180' and 270'. The file being read ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    13

    Unhappy Reading in a text file

    I am creating a program where I have to rotate an image 90', 180' and 270'. The file being read in is an image file converted to numbers and these are read into an array.
    The image is 60 ROWS by 60 COLS, the array being Picture2

    To rotate the image 90' i am doing the following;

    for (i=0; i<ROWS; i++)
    for (j=0; j<COLS; j++)
    Picture2[COLS-1-j][i]=Picture[i][j];


    and to rotate the image 270' i am doing the following;

    for (i=0; i<ROWS; i++)
    for (j=0; j<COLS; j++) Picture2[j][ROWS-1-i]=Picture[i][j];


    but I have no idea how to rotate it by 180' without doing the obvious of printing it out and turning the bit paper upside down!

    Thanks for any help, it is EXTREMELY appreciated and if you need to look at the program then please email me and I will be happy to send you it ok!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,453
    > but I have no idea how to rotate it by 180'
    Didn't occur to you to call "rotate the image 90'" twice?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Reading Character at a time from a text file
    By Giania in forum C Programming
    Replies: 8
    Last Post: 02-25-2006, 02:17 PM
  5. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 01:59 PM

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