08-13-2008 12:55 PM
1. What does PathToCString() return if there is an error?
2. Is there someplace where this is documented?
08-14-2008 02:27 AM - edited 08-14-2008 02:29 AM
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
08-14-2008 03:00 AM
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?
08-14-2008 12:05 PM
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 the
following 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 to
allocate memory for the string, and would like to check for an insufficient
memory condition.
A second question: If I'm right that PathToCString() dynamically allocates memory
for the C string corresponding to the Path, do I need to subsequently free that
memory? If so, what function would I call?
Thanks again for your help!
Steve
08-14-2008 02:26 PM
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 here
Greetings from Germany!
--
Uwe
08-14-2008 04:40 PM
Hi Uwe,
Thanks for taking a look.
Greetings from California!
Steve
08-14-2008 04:56 PM
Hi Steve,
The PathToCString function is used when you convert a LabVIEW path to a C string datatype. This knowledgebase discusses more about it.
08-14-2008 07:12 PM
Hi Karunya,
Thanks for your response. Unfortunately, when I tried to go the link you provided,
I got a "Page not found" error. Could you please provide the link again?
Thanks,
Steve
08-18-2008 05:07 AM
Karunya,
The link you provided is not working.
08-18-2008 05:25 AM
stevehs17 wrote:I got a "Page not found" error. Could you please provide the link again?