<div>Frank:</div>
<div> Thanks for your reply. I thought that there could be a trim funcion on CPL... I will use that code to trim my string...</div>
<div> </div>
<div>Another question: To get several fields from the file's metadata, is it better to use <font size="2">GetMetadata() and then search within the array for the fields, or use GetMetadataItem() several times in order to get the necesary fields? </font></div>
<div><font size="2">GetMedata() can take more memory than necesary, but I'm not sure if GetMetadataItem() performs a read on the file, which could be slow...</font></div>
<div> </div>
<div>Regards</div>
<div>Alex<br><br></div>
<div class="gmail_quote">2011/6/14 Frank Warmerdam <span dir="ltr"><<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="im">On 11-06-14 10:08 AM, Alex Mantaut wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi Frank:<br> Thanks for your response. I wasn't sure if the whitespace was<br>allways going to be there, because for some fields had the white space but<br>
others didn't. I will remove the trailing whitespace.<br>Now, I'm trying to develop a modification on the HDF5 driver to allow it to get<br>the georreference information from COSMO-SKYMED HDF5 files... The thing is I'm<br>
not really familiar with the libraries used by GDAL(the use of iostream is not<br>allowed right?), what would be the better way to trim a string? I looked into<br>cpl_string and didn't found a simple way to do it (I could use<br>
CSLTokenizeString() and get the first field on the list, but this seems overly<br>convoluted for a simple trim)<br>Also, is there any guidelines on which libraries to use on C++ in replace of<br>their std equivalents?<br>
</blockquote><br></div>Alex,<br><br>I would likely do something like:<br><br> CPLString osMD = poDS->GetMetadataItem('...');<br><br> while( osMD.size() > 0 && osMD[osMD.size()-1] == " " )<br>
osMD.resize(osMD.size()-1));<br><br>You can use STL and sstream though we don't normally do file io through<br>iostreams since we go through the VSI*L "posix-like" API which allows<br>io virtualization.<br>
<br>Note that CPLString is just an improved (or as some would say polluted)<br>std::string.
<div>
<div></div>
<div class="h5"><br><br>Best regards,<br>-- <br>---------------------------------------+--------------------------------------<br>I set the clouds in motion - turn up | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>
light and sound - activate the windows | <a href="http://pobox.com/~warmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>and watch the world go round - Rush | Geospatial Programmer for Rent<br><br>_______________________________________________<br>
gdal-dev mailing list<br><a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--<br> Alex Mantaut<br>SUR Emprendimientos Tecnológicos<br><br>Perú 345 Piso 5to Oficina "B" (C1067AAG)<br>Ciudad de Buenos Aires, Argentina<br>
Tel. +54 (11) 4342-2976/84<br><a href="mailto:javierurien@suremptec.com.ar" target="_blank">javierurien@suremptec.com.ar</a><br><a href="http://www.suremptec.com/" target="_blank">www.suremptec.com</a><br>