reading bitmap into array

This is a discussion on reading bitmap into array within the C Programming forums, part of the General Programming Boards category; Originally Posted by Sebastiani puts("Iceberg at 12 o'clock - full speed ahead!"); No you are supposed to do that first, ...

  1. #31
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Sebastiani View Post
    puts("Iceberg at 12 o'clock - full speed ahead!");
    No you are supposed to do that first, then scuttle the vessel.

    puts("The Captain has won the game. Swim for your lives.");
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  2. #32
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    puts("I don't know how to swim!");

    please throw a life preserver, I don't care if we need to unwind the stack!
    Last edited by ಠ_ಠ; 07-26-2009 at 03:19 PM.
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  3. #33
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    You need to compile with -SNAFU -allfloats
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #34
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,699
    >> Thanks for all the suggestions but despite my constant resizing being inefficient, it's part of the directions, so I will follow that.

    In that case, go back to your original code.

    Code:
    set 'nsize' to 1 and allocate a byte. 
    	loop (omit the loop control field in the for loop entirely)
    	fread one byte
    	if fread fails, exit the loop
    	increment bitmap::size
    	if bitmap::size is equal to 'nsize', double 'nsize' and realloc (as you had in the original code)
    Code:
    bool fun(bool value)
    {
        return std::pow(std::exp(1), std::complex<float>(0, 1) 
        * std::complex<float>(std::atan(1)*(1 << (value + 2))))
        .real() > 0;
    }

  5. #35
    Registered User
    Join Date
    Jul 2009
    Posts
    14
    Haha, you guys seem to be having fun.

    Thanks a lot for all the help! I've successfully been able to read from the header all the necessary information and so I'm just working on a nifty encryption now. Thanks again!

  6. #36
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,699
    >> You need to compile with -SNAFU -allfloats

    That won't work with GCC, though. How about -mhard-float -mno-fast-fix -mno-single-exit?

    Yeah, that sounds about right.
    Code:
    bool fun(bool value)
    {
        return std::pow(std::exp(1), std::complex<float>(0, 1) 
        * std::complex<float>(std::atan(1)*(1 << (value + 2))))
        .real() > 0;
    }

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-02-2009, 06:27 AM
  2. Reading a list of ints from file into an array
    By mesmer in forum C Programming
    Replies: 1
    Last Post: 11-10-2008, 05:45 AM
  3. Reading integers from a File into an Array
    By bobby19 in forum C Programming
    Replies: 13
    Last Post: 10-09-2006, 01:36 AM
  4. Reading a file into an array for fast access later
    By matsharp in forum C Programming
    Replies: 10
    Last Post: 08-03-2006, 02:42 AM
  5. Replies: 1
    Last Post: 04-25-2006, 12:14 AM

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