// it refers all to // https://stackoverflow.com/questions/11362771/list-files-in-directory-c // https://bituse.info/winapi/31 // // Parameters // // lpcstr_path // // Directory name which is going to be found files. // // Return Value // // char** // // File list under the lpcstr_path, which has fullpath. // char** FileControler::get_files ( char* lpcstr_path, int* file_num ) {
I reffered to the elder program and would learn a lot of things.
We usually use get and file process.
Process on the way of seeing vax
-> we are on a vax see
421 :/*********************************************************************/ 422 :/* */ 423 :/* subroutine get_files - get input filenames and open */ 424 :/* */ 425 :/*********************************************************************/ 426 : 427 :int get_files(host) 428 :int host; 429 :{ 430 : short shortint; 431 : typedef long off_t; 432 : 433 : if (inname[0] == ' ') { 434 : printf("\nEnter name of file to be decompressed: "); 435 : gets (inname); 436 : } 437 : 438 : if (host == 1 | host == 2) { 439 : if ((infile = open(inname,O_RDONLY | O_BINARY)) <= 0) { 440 : fprintf(stderr,"\ncan't open input file: %s\n",inname); 441 : exit(1); 442 : } 443 : } 444 : else if (host == 3 | host == 5) { 445 : if ((infile = open(inname,O_RDONLY)) <= 0) { 446 : fprintf(stderr,"\ncan't open input file: %s\n",inname); 447 : exit(1); 448 : } 449 : 450 : /****************************************************************/ 451 : /* If we are on a vax see if the file is in var length format. */ 452 : /* This logic is in here in case the vax file has been stored */ 453 : /* in fixed or undefined format. This might be necessary since */ 454 : /* vax variable length files can't be moved to other computer */ 455 : /* systems with standard comm programs (kermit, for example). */ 456 : /****************************************************************/ 457 : 458 : if (host == 3) { 459 : read(infile,&shortint, (size_t) 2); 460 : if (shortint > 0 && shortint < 80) { 461 : host = 4; /* change host to 4 */ 462 : printf("This is not a VAX variable length file."); 463 : } 464 : else printf("This is a VAX variable length file."); 465 : lseek(infile,(off_t) 0,0); /* reposition to beginning of file */ 466 : } 467 : } 468 : 469 : if (output_format == 0) 470 : do { 471 : printf("\nEnter a number for the output format desired:\n"); 472 : printf("\n 1. SFDU/PDS format."); 473 : printf("\n 2. FITS format."); 474 : printf("\n 3. VICAR format."); 475 : printf("\n 4. Unlabelled binary array.\n"); 476 : printf("\n Enter format number:"); 477 : gets(inname); 478 : output_format = atoi(inname); 479 : } while (output_format < 1 || output_format > 4); 480 : 481 : if (outname[0] == ' ') { 482 : printf("\nEnter name of uncompressed output file: "); 483 : gets (outname); 484 : } 485 : 486 : return(host); 487 :} 488 :