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

Method reopen

LASlib/src/lasreader_ply.cpp:765–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

763}
764
765BOOL LASreaderPLY::reopen(const char* file_name)
766{
767 int i;
768
769 if (file_name == 0)
770 {
771 laserror("file name pointer is zero");
772 return FALSE;
773 }
774
775 file = fopen_compressed(file_name, "r", &piped);
776 if (file == 0)
777 {
778 laserror("cannot reopen file '%s'", file_name);
779 return FALSE;
780 }
781
782 if (setvbuf(file, NULL, _IOFBF, 10*LAS_TOOLS_IO_IBUFFER_SIZE) != 0)
783 {
784 LASMessage(LAS_WARNING, "setvbuf() failed with buffer size %d", 10*LAS_TOOLS_IO_IBUFFER_SIZE);
785 }
786
787 // read the first line with full parse_string
788
789 i = 0;
790 while (fgets(line, 512, file))
791 {
792 if (parse(parse_string))
793 {
794 // mark that we found the first point
795 i = 1;
796 break;
797 }
798 else
799 {
800 line[strlen(line)-1] = '\0';
801 LASMessage(LAS_WARNING, "cannot parse '%s' with '%s'. skipping ...", line, parse_string);
802 }
803 }
804
805 // did we manage to parse a line
806
807 if (i != 1)
808 {
809 laserror("could not parse any lines with '%s'", parse_string);
810 fclose(file);
811 file = 0;
812 return FALSE;
813 }
814
815 p_idx = 0;
816 p_cnt = 0;
817 return TRUE;
818}
819
820void LASreaderPLY::clean()
821{

Callers

nothing calls this directly

Calls 4

laserrorFunction · 0.85
fopen_compressedFunction · 0.85
LASMessageFunction · 0.85
parseFunction · 0.85

Tested by

no test coverage detected