Thread: Writing some kind of extractor or installer.

  1. #16
    Just a Human Anuradh_a's Avatar
    Join Date
    Jan 2008
    Posts
    50
    hey guys
    how about using resources??

  2. #17
    Registered User
    Join Date
    Jan 2008
    Posts
    182
    Quote Originally Posted by Salem View Post
    > while(p != &_binary_data_avi_end);
    The ; at the end makes this an infinite loop

    Why not write the entire block in one fwrite call?
    How would I write the entire block? For that I think I need to know the size, but I'm not sure how to get the size.

  3. #18
    Registered User
    Join Date
    Jan 2008
    Posts
    182
    ... oh and what do you mean by "block"?

    And I don't know what a resource is.

  4. #19
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    ptrdiff_t len = end - start;
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #20
    Just a Human Anuradh_a's Avatar
    Join Date
    Jan 2008
    Posts
    50
    you can add files to your executables as resources.so when you want to use them you
    can extract it and use it. I think it works for the bigger files.

  6. #21
    Registered User
    Join Date
    Jan 2008
    Posts
    182
    Quote Originally Posted by Salem View Post
    ptrdiff_t len = end - start;
    Thanks a lot!

    One small question about that ptrdiff_t type. What exactly will 'len' be, the size of bytes? Or would that depend on the types of pointers I'm subtracting?

    'cause I just subtracted the addresses of binary_data_avi_start and binary_data_avi_end without specifying a pointer type.

  7. #22
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    It's related to the type.

    So if you have
    int array[10];
    int *p = &array[5];

    then p - array will be 5
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #23
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    Btw, there is another way to embed something into your application such as appending data(s) into the end of your executable file. This method less efficient for large data because it will search the given markers to determine the position of your datas.
    Quote Originally Posted by Anuradh_a View Post
    how about using resources??
    Since windows provided APIs to modifying resources, it's less protective. If you want somebody could 'easily' change something in your application then probably you can use it.

  9. #24
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    > If you want somebody could 'easily' change something in your application then probably you can use it.

    No different than the method mentioned above.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing a UDF in C++
    By kripatel in forum Linux Programming
    Replies: 0
    Last Post: 03-22-2008, 04:14 PM
  2. help in writing a C-Progrm
    By kumaravel_futu in forum C Programming
    Replies: 10
    Last Post: 02-11-2008, 01:02 PM
  3. Experienced coders read. ( Common/efficient writing )
    By knave in forum C++ Programming
    Replies: 8
    Last Post: 04-23-2003, 09:07 PM
  4. Writing "Enter" character to a txt file
    By Hankyaku in forum C++ Programming
    Replies: 2
    Last Post: 04-08-2003, 11:06 AM
  5. The Art of Writing Comments :: Software Engineering
    By kuphryn in forum C++ Programming
    Replies: 15
    Last Post: 11-23-2002, 05:18 PM