Discussion:
labview manager function error codes
(too old to reply)
stevehs17
2008-08-13 18:10:09 UTC
Permalink
1. What does PathToCString() return if there is an error?2. Is there someplace where this is documented? 
LuI
2008-08-14 07:40:22 UTC
Permalink
Steve,

what do you mean with 'error'?
I have tried out some simple bad pathes on LV7.11 on XP and have found that it simply returns the string representation of what was fed into as path. And this is what is said in the help for that function:
 > Path To String
> Converts path into a string describing a path in the standard format of the platform. The connector pane displays the default data types for this polymorphic function.
> path is the path, array of paths, cluster of paths, or array of clusters of paths you want to convert to a string. If path is , the function sets string to .
> string is the path descriptor(s) represented by path in the standard format for the current platform. string is of the same data type structure as path.  

There is, however, no 'error in' control that could take a specific error and account for it. Greetings from Germany!
--
Uwe Message Edited by LuI on 08-14-2008 09:29 AM
muks
2008-08-14 08:10:10 UTC
Permalink
 
1. What does PathToCString() return if there is an error?2. Is there someplace where this is documented?
  I Think there is no  error that u will get from path to string as lul has mentioned. U will though get the error if u feed that string(Considering somthing wrong) to concatenate string and then feed it to for example a write function.It will return a path not found.Can you explain what u r trying to do?
stevehs17
2008-08-14 17:10:07 UTC
Permalink
Hi Uwe and Muks, Thanks for your responses. Uwe, you mention there is help on the PathToCString() function. Where is it? When I search on "PathToCString" in the LabVIEW help, it says "No topics found" (though there is an entry for FStringToPath).  What I am doing is using the LabVIEW file dialog to select a file, then passing the path to thefollowing C function to open the selected file for reading: FILE *openfile(Path p)
{
    UHandle sp;
   
    sp = PathToCString(p);
    return fopen((char *)(*sp),"r");    /* a LabVIEW UHandle is a char** */
}
 This works, but I'm guessing it could fail if there's not enough memory toallocate memory for the string, and would like to check for an insufficientmemory condition.  A second  question: If I'm right that PathToCString() dynamically allocates memoryfor the C string corresponding to the Path, do I need to subsequently free thatmemory? If so, what function would I call?  Thanks again for your help! Steve 
LuI
2008-08-14 19:40:08 UTC
Permalink
Steve, I'm sorry I have misread your Q as to relating to LabVIEW node 'Path To String'. You have,however asked for 'PathToCString()'. So my answer iscompletely unrelated. Sorry again.AFAIK you need to call the LV manager to free memory you have allocated using its functionality. But as I do allmost all my programming in LabVIEW, I am not of any help hereGreetings from Germany!
--
Uwe
Karunya_R
2008-08-14 22:10:06 UTC
Permalink
Hi Steve, &nbsp;The PathToCString function is used when you convert a LabVIEW path to a C string datatype. This <a href="http://ae.natinst.com/operations/ae/public.nsf/allbydate/570347F3698A716D862571040071FC0A?OpenDocument&amp;srnumber=1219247&amp;message=S&amp;updateflag=#srlink" target="_blank">knowledgebase</a> discusses more about it.&nbsp;
stevehs17
2008-08-14 22:10:04 UTC
Permalink
Hi Uwe,&nbsp;Thanks for taking a look.&nbsp;Greetings from California!&nbsp;Steve&nbsp;
stevehs17
2008-08-15 00:40:18 UTC
Permalink
Hi Karunya,&nbsp;Thanks for your response. Unfortunately, when I tried to go the link you provided,I got a &quot;Page not found&quot; error. Could you please provide the link again?&nbsp;Thanks,Steve&nbsp;
Loading...