Thread: Files wont zip into exe

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    19

    Files wont zip into exe

    Hello,

    I'm trying to run code to compress some files into an exe format. The files seem to convert into a zip fine. But then they wont convert from zip into an exe. Then the program gets hung. I would appreciate any help.

    Code:
    fprintf(log_file,"Commands for Folder %s:\n",folder);
    if (strcmp(mode,"c") == 0)
    {
          sprintf(stemp, "del %s\\%s.bkp.exe", folder, filename); /*delete backup exe file that may have been created*/
          fprintf(log_file,"  %s\n",stemp);
          system(stemp);
          sprintf(stemp, "wzzip %s\\%s.zip %s\\%s.txt", folder, filename, folder, filename); /*create zip file*/
          fprintf(log_file,"  %s\n",stemp);
          system(stemp);
          sprintf(stemp, "wzipse32 %s\\%s.zip -d %s\\%s\\%s -y -auto",folder, filename, extr_loc_p1, c_file.name, extr_loc_p2); /*create self extracting executable*/
          fprintf(log_file,"  %s\n",stemp);
          system(stemp);
          sprintf(stemp, "del %s\\%s.txt", folder, filename);
          fprintf(log_file,"  %s\n",stemp);
          system(stemp);
          strcpy(folder, directory);
    }
    else if (strcmp(mode,"cs") == 0) 
    {
          sprintf(stemp, "del %s\\%s.bkp.exe", folder, filename); /*delete backup exe file that may have been created*/
          fprintf(log_file,"  %s\n",stemp);
          system(stemp);
          sprintf(stemp, "wzzip %s\\%s.zip %s\\%s.txt", folder, filename, folder, filename); /*create zip file*/
          fprintf(log_file,"  %s\n",stemp);
          system(stemp);
          sprintf(stemp, "wzipse32 %s\\%s.zip -d %s\\%s\\%s -y -auto",folder, filename, extr_loc_p1, c_file.name, extr_loc_p2); /*create self extracting executable*/
           fprintf(log_file,"  %s\n",stemp);
           system(stemp);
           sprintf(stemp, "del %s\\%s.txt", folder, filename);
          fprintf(log_file,"  %s\n",stemp);
          system(stemp);
          set_security();
           strcpy(folder, directory);
    Last edited by smarta_982002; 02-19-2008 at 03:28 PM.

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    You have lines too long in your code
    What you could do - at least remove leading 4 tabs before posting
    (most editors will do it for you if you select several lines and press Shift-tab)
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Ah, but you shouldn't remove all indentation. Vart merely suggested you remove superfluous indentation.
    Code:
    				my code
    Unnecessary. Could be:
    Code:
    My code
    But this...
    Code:
    if (x)
    // do x
    Is not so very good because it makes it hard to read, so it's perfectly fine to indent:
    Code:
    if (x)
    	// do x
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  2. fopen vs. _open (for BIG image files)
    By reversaflex in forum C Programming
    Replies: 3
    Last Post: 04-01-2007, 12:52 AM
  3. Using files in side a zip of cab
    By Skeptic in forum Windows Programming
    Replies: 2
    Last Post: 03-14-2003, 02:38 AM
  4. How to link bpl files into exe?
    By Unregistered in forum C++ Programming
    Replies: 0
    Last Post: 06-22-2002, 10:38 AM
  5. EXE files...
    By Brian in forum C Programming
    Replies: 7
    Last Post: 02-19-2002, 12:42 AM