LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview manager function error codes

1. What does PathToCString() return if there is an error?

2. Is there someplace where this is documented? 

0 Kudos
Message 1 of 12
(3,159 Views)

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
Message 2 of 12
(3,139 Views)

 


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?

0 Kudos
Message 3 of 12
(3,134 Views)

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 

0 Kudos
Message 4 of 12
(3,124 Views)

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

Message 5 of 12
(3,114 Views)

Hi Uwe,

 

Thanks for taking a look.

 

Greetings from California!

 

Steve 

0 Kudos
Message 6 of 12
(3,104 Views)

Hi Steve,

 

The PathToCString function is used when you convert a LabVIEW path to a C string datatype. This knowledgebase discusses more about it. 

Warm regards,
Karunya R
National Instruments
Applications Engineer
Message 7 of 12
(3,102 Views)

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 

0 Kudos
Message 8 of 12
(3,095 Views)

Karunya,

                The link you provided is not working.  

0 Kudos
Message 9 of 12
(3,065 Views)

stevehs17 wrote:

I got a "Page not found" error. Could you please provide the link again?


knowledgebase

Message 10 of 12
(3,060 Views)