Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title PtFSGetCurrent problem
Ref. No. QNX.000009792
Category(ies) Development
Issue When using PtFSGetCurrent function to get a directory path
e.g.x09PtFileSelItem_t *item;
x09 x09item = PtFSGetCurrent(widget);

Later when we look at item->fullpath, we see paths that look like"/home//tom".

Is this double // supposed to be there, because when we use it in an fopen() it fails?



Solution The double slash is the cause of the problem. It is a special series of characters that is designed for node numbers. You can add more then 2 slashes though. This will look like a single slash.

In a simple fopen test, the following program printed out "fopen succeeded".

x09#include <stdio.h>
x09#include <unistd.h>
x09#include <errno.h>

x09void main(int argc, char *argv[], char x09*envp[]){
x09x09FILE *f;
x09x09f = fopen("/home//something/////some.c","r+");
x09if (f != NULL)
x09x09printf("fopen succededn");
x09else
x09x09printf("fopen failed with errno %dn", errno);
x09}

So check for other incorretness in your path.