Changeset 1580:c25654b46677
- Timestamp:
- 02/13/10 12:20:54 (6 months ago)
- Branch:
- default
- File:
-
- 1 edited
-
apps/las2las.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
apps/las2las.c
r1495 r1580 36 36 #define LAS_FORMAT_12 2 37 37 38 void do_bulk_copy(const char* infile, size_t in_start_point, const char* outfile) 39 { 40 /* bulk copy assumes that the header has already been written to outfile 41 as it is supposed to be, and that we're just going to copy all of the 42 points in infile as they are. 43 */ 44 FILE* file_out = 0; 45 FILE* file_in = 0; 46 47 size_t read = 0; 48 size_t written = 0; 49 size_t size = 1000; 50 51 char *buffer = 0; 52 53 buffer = (char*) malloc(size * sizeof(char)); 54 55 if (buffer == 0) { 56 LASError_Print("unable to allocate buffer copy"); 57 exit(1); 58 } 59 file_in = fopen(infile, "rb"); 60 fseek(file_in, in_start_point, SEEK_SET); 61 62 if (file_in == 0) { 63 LASError_Print("input filename not valid for bulk copy"); 64 exit(1); 65 } 66 file_out = fopen(outfile, "ab+"); 67 if (file_out == 0) { 68 LASError_Print("output filename not valid for bulk copy"); 69 exit(1); 70 } 71 72 while (feof(file_in) == 0) { 73 read = fread(buffer, 1, size, file_in); 74 written = fwrite(buffer, 1, read, file_out); 75 76 if (read != written) { 77 LASError_Print("unable to write data in bulk copy"); 78 exit(1); 79 } 80 } 81 82 fclose(file_in); 83 fclose(file_out); 84 free(buffer); 85 } 38 86 39 87 … … 117 165 int skip_invalid = FALSE; 118 166 int format = LAS_FORMAT_12; 167 int bulk_copy = FALSE; 119 168 120 169 LASReaderH reader = NULL; … … 185 234 skip_invalid = TRUE; 186 235 } 236 else if ( strcmp(argv[i],"-b") == 0 || 237 strcmp(argv[i],"--bulk") == 0 238 ) 239 { 240 bulk_copy = TRUE; 241 } 242 187 243 else if ( strcmp(argv[i],"--input") == 0 || 188 244 strcmp(argv[i],"-input") == 0 ||
Note: See TracChangeset
for help on using the changeset viewer.
