MCPcopy Create free account
hub / github.com/LAStools/LAStools / reopen

Method reopen

LASlib/src/lasreader_asc.cpp:518–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516}
517
518BOOL LASreaderASC::reopen(const CHAR* file_name)
519{
520 if (file_name == 0)
521 {
522 laserror("file name pointer is zero");
523 return FALSE;
524 }
525
526 file = fopen_compressed(file_name, "r", &piped);
527 if (file == 0)
528 {
529 laserror("cannot reopen file '%s'", file_name);
530 return FALSE;
531 }
532
533 if (setvbuf(file, NULL, _IOFBF, 10 * LAS_TOOLS_IO_IBUFFER_SIZE) != 0)
534 {
535 LASMessage(LAS_WARNING, "setvbuf() failed with buffer size %d", 10 * LAS_TOOLS_IO_IBUFFER_SIZE);
536 }
537
538 // read the header lines
539
540 I32 i;
541 for (i = 0; i < header_lines; i++)
542 {
543 fgets(line, line_size, file);
544 }
545
546 // special handling for European numbers
547
548 if (comma_not_point)
549 {
550 I32 i, len = (I32)strlen(line);
551 for (i = 0; i < len; i++)
552 {
553 if (line[i] == ',') line[i] = '.';
554 }
555 }
556
557 col = 0;
558 row = 0;
559 p_idx = 0;
560 p_cnt = 0;
561 // skip leading spaces
562 line_curr = 0;
563 while ((line[line_curr] != '\0') && (line[line_curr] <= ' ')) line_curr++;
564
565 return TRUE;
566}
567
568void LASreaderASC::clean()
569{

Callers

nothing calls this directly

Calls 3

laserrorFunction · 0.85
fopen_compressedFunction · 0.85
LASMessageFunction · 0.85

Tested by

no test coverage detected