| 12345678910111213141516171819202122232425262728293031 |
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #include "packing.h"
- int main(int argc, char **argv){
- //check arguments
- if (argc != 3){
- printf("usage: ./proj4 <input_file> <output_file>\n");
- return EXIT_FAILURE;
- }
-
- // read data
- Node *root = load_file(argv[1]);
- if(root == NULL){ // check for error
- printf("File read error.");
- return EXIT_FAILURE;
- }
-
- double *best_width = root->width;
- double *best_height = root->height;
- find_best_fit(root, best_width, best_height);
-
- // save boxes
- save_boxes(argv[2], root);
-
- // clean up
- free(array); // free memory
- return EXIT_SUCCESS; // exit
- }
|