Problems in code with winzip

This is a discussion on Problems in code with winzip within the C Programming forums, part of the General Programming Boards category; Hello, I'm running some code to compress some files. When I run a scheduled task the program hangs sometimes. However, ...

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

    Problems in code with winzip

    Hello,

    I'm running some code to compress some files. When I run a scheduled task the program hangs sometimes. However, when I run it directly from the command line, it works every time. I believe that something is wrong with Winzip. I've heard that people have had problems with Winzip in the past. I have version 8.1. The following is my code. Please let me know if there is somewhere I can make the code more robust or maybe change it. Thanks.

    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 02:15 PM.

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    Where does the program hang, pray tell?
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    The program converts the file into a zip. Then it hangs when it tries to go from a zip to an exe.

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,646
    I would make sure your scheduled task can interact with the desktop and is running under the logged on users account.

    gg

  5. #5
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    Yes, the task is running under the logged on users account and can interact with the desktop

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems with compiling code in cygwin
    By firyace in forum C++ Programming
    Replies: 4
    Last Post: 06-01-2007, 08:16 AM
  2. Problems with GetDiskFreeSpaceEx/my code...
    By scrappy in forum Windows Programming
    Replies: 1
    Last Post: 07-30-2003, 11:16 AM
  3. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 11:51 AM
  4. structs, array, code has problems, Im lost
    By rake in forum C++ Programming
    Replies: 4
    Last Post: 03-13-2002, 01:02 AM
  5. problems with output from code
    By simhap in forum C++ Programming
    Replies: 0
    Last Post: 10-08-2001, 12:43 PM

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