<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
My guess is still: <br>
- the path and filename you provide is checked by the various create
functions. <br>
- there seems to be a problem when the path leads to the SD card, thus
both the path and the filename default to an empty string. <br>
- so the path is empty, which - as a relative path - simply means: "in
the current directory". And the current directory might be the system
root. Thus the files are created there<br>
- cause the filename is empty, too, the filename plus the endings
".dbf", ".shp" etc. are simply: ".dbf", ".shp". Maybe the dot before as
a first character is not allowed and thus truncated or your file viewer
(whichever you use) automatically hides the dot.<br>
<br>
Just a guess....<br>
<br>
<div class="moz-signature">Best regards,<br>
<br>
Christian<br>
<small><b>Directmedia Publishing GmbH</b> · Möckernstraße 68 · 10965
Berlin<br>
<a class="moz-txt-link-abbreviated" href="http://www.digitale-bibliothek.de">www.digitale-bibliothek.de</a><br>
AG Berlin-Charlottenburg · HR B 58002 · USt.Id. DE173211737<br>
Geschäftsführer: Ralf Szymanski · Erwin Jurschitza</small></div>
<br>
<br>
thecrashteam schrieb:
<blockquote cite="mid:17823180.post@talk.nabble.com" type="cite">
  <pre wrap="">Hi,

I have something new. Like you said Bram, my files are created but they are
not created in the specified folder. They are created on the system root.
But there is something weird. I want to create test.shp, test.shx and
test.dbf files but files which are created are named "dbf", "shp" and "shx".
They have no extension. Moreover, when I add an extension to my dbf file, in
order to view its content, I have a string which does not match with the one
I want to put in (I put "to" and it contains " þ").
Even if I want to create my files in another folder (created on the system
root for example) they are created on the system root...
can you tell me if this is normal?

Romain


Bram de Greve wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">OK, this is _really_ weird, as _all_ return values indicate that every 
single call was successful.

DBFCreate and SHPCreate return values different than zero, meaning they 
were actually able to create files and return handles to them.
DBFAddField return the field number and -1 on failure.  0 just means 
this is the first field successfully added.
DBFWriteStringAttribute returns true on success, 1 is true.
SHPCreateSimpleObject returns a handle to an object which is non-zero, 
and thus a success.
SHPWriteObject returns the index of the object within the file.  0 just 
means this is the first object, and thus a success.

So, from everything I can see here, a file _must_ have been created 
somewhere, as none of these calls (except SHPCreateSimpleObject ) could 
have been successful if this wasn't the case.  As far I as understand 
shapelib, there is no other way possible.

I can imagine only two things:
- the filename is doing something funny.  Please, try simpler cases.
- the C# layer is doing something funny.  Who has created the C# 
library?  Maybe he/her can help you better ...

Bram

thecrashteam wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Thank you for your help Bram, it is very nice !
So, I did a list of return values of functions used in my code :
DBFCreate returns 375328,
SHPCreate = 379776,
DBFAddField = 0,
DBFWriteStringAttribute = 1,
SHPCreateSimpleObject = 410704,
SHPWriteObject = 0.

I hope you could tell me what these figures mean... And do you know where
could I find documentation about shapelib ?

Thank you again for your help

Romain.



Bram de Greve wrote:
  
      </pre>
      <blockquote type="cite">
        <pre wrap="">The extension has nothing to do with it.  At worst, it would create 
something like test.shp.shp.

As no files AT ALL are created, the problem probably is within DBFCreate 
and SHPCreate, as they should create file files straight away, even 
without the data being added.  Please, check the return values of 
DBFCreate and SHPCreate.   Are they null?  Probably they are, and that 
means the creation of the files simply fail.  And thus everything else 
fails too.

Try a more simple filename like just "test".

Are you prepared to step through the code in a debug session.  Maybe you 
can figure out what exactly fails ...

Good luck =)
Bram

thecrashteam schreef:
    
        </pre>
        <blockquote type="cite">
          <pre wrap="">Hi  Vassilis,


I tried what you told me too, but it still not work. No error, but no
files... It's hopeless !! ^^
I think there is something wrong against me with this library !!!

Thank you for your reply !

Romain

My code : 

//création du dbf
IntPtr ptrDBFCreate =
shpFile.DBFCreate(@"\SD-MMCard\TestParcelle\test");

//création du shapefile
IntPtr ptrSHPCreate =
shpFile.SHPCreate(@"\SD-MMCard\TestParcelle\test",
ShapeFile.ShapeFile.ShapeType.Point);

//nouvelle colonne dans le dbf
shpFile.DBFAddField(ptrDBFCreate, @"\SD-MMCard\TestParcelle\test",
ShapeFile.ShapeFile.DBFFieldType.FTString, 255, 0);

//écriture de la valeur liée au futur shape
shpFile.DBFWriteStringAttribute(ptrDBFCreate,
shpFile.DBFGetRecordCount(ptrDBFCreate), 0, "to");

//création du point
double[] x = new double[1];
double[] y = new double[1];
double[] z = new double[1];
x[0] = 803606;
y[0] = 803606;
z[0] = 0;

IntPtr psObject =
shpFile.SHPCreateSimpleObject(ShapeFile.ShapeFile.ShapeType.Point, 1,
x,
y,
z);

//écriture du point dans le shape
shpFile.SHPWriteObject(ptrSHPCreate, -1, psObject);

//fermeture du dbf et du shapefile
shpFile.SHPClose(ptrSHPCreate);
shpFile.DBFClose(ptrDBFCreate);
  
      
          </pre>
        </blockquote>
        <pre wrap="">_______________________________________________
Shapelib mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Shapelib@lists.maptools.org">Shapelib@lists.maptools.org</a>
<a class="moz-txt-link-freetext" href="http://lists.maptools.org/mailman/listinfo/shapelib">http://lists.maptools.org/mailman/listinfo/shapelib</a>


    
        </pre>
      </blockquote>
      <pre wrap="">  
      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
Shapelib mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Shapelib@lists.maptools.org">Shapelib@lists.maptools.org</a>
<a class="moz-txt-link-freetext" href="http://lists.maptools.org/mailman/listinfo/shapelib">http://lists.maptools.org/mailman/listinfo/shapelib</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>