Mateusz-

 

Thanks for the quick response, I greatly appreciate it.

 

I attached my cpp file. I was trying first to write a file with a single
point, then switch that line at the top that is commented out and recompile
to read the file back in.

 

As I said, I can successfully execute this code in release mode only. I'll
try building the debug versions of liblas that I need to debug inside
liblas. Maybe I can give better information about exactly where and why it
crashes in the debugger.

 

Thanks-

 

 

On Tue, Aug 25, 2009 at 6:30 PM, Mateusz Loskot <[email protected]> wrote:

Mateusz Loskot wrote:

> Gary Robinson wrote:
>> I can work around the problem by running in release mode only, but it is
>> somewhat inconvenient. Either way, there are probably memory bugs in the
1.2
>> release. If you run your c++ tutorial code in the visual studio debugger
you
>> could probably find the problems and have a more stable release. For what
>> it's worth, in my first message I mentioned the call stack when the
writer
>> crashes, and a buffer overrun error. Looking into it more, when the
reader
>> crashes, it has been near the malloc call of the new operator. Just more
>> evidence of memory allocation problems.
>
> Possibly, heap corruption occurs.
> Tomorrow, I'll try to run the code from the tutorial and see myself.

By the way, ideally if you could attach complete program (.cpp file
only) you've written based on the tutorial, so I can use exactly the
same code.


Best regards,
--
Mateusz Loskot,  <http://mateusz.loskot.net> http://mateusz.loskot.net
Charter Member of OSGeo,  <http://osgeo.org> http://osgeo.org

 

 

Gary Robinson

Software Engineer, Intelisum Inc.

801-924-0660 ext 127

[email protected]

 

Privileged/Confidential Information may be contained in this message.  If
you are not the addressee indicated in this message (or responsible for
delivery of the message to such person), you may not copy or deliver this
message to anyone. In such case, you should destroy this message and kindly
notify the sender by reply email. Please advise immediately if you or your
employer do not consent to Internet email for messages of this kind.

 

<<image001.jpg>>

// TestLAS.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <liblas/laspoint.hpp>
#include <liblas/lasreader.hpp>
#include <liblas/laswriter.hpp>

#include <fstream>  // std::ifstream
#include <iostream> // std::cout

using namespace liblas;

int _tmain(int argc, _TCHAR* argv[])
{
        //bool bRead = true;
        bool bRead = false;
        
        if(bRead)
        {
                std::ifstream ifs;
                ifs.open("test.las", std::ios::in | std::ios::binary);
                
                liblas::LASReader reader(ifs);
                liblas::LASHeader const& header = reader.GetHeader();

                std::cout << "Signature: " << header.GetFileSignature() << '\n';
                std::cout << "Points count: " << header.GetPointRecordsCount() 
<< '\n';
                
                ifs.close();
        }
        else
        {
                std::ofstream ofs;
                ofs.open("test.las", std::ios::out | std::ios::binary);

                liblas::LASHeader header;
                header.SetDataFormatId(LASHeader::ePointFormat1);

                liblas::LASWriter writer(ofs, header);

                liblas::LASPoint point;
                point.SetCoordinates(10,20,30);
                writer.WritePoint(point);               
        }

        return 0;
}

_______________________________________________
Liblas-devel mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/liblas-devel

Reply via email to