Forum Topic - Creat and transfer files from QNX Target to Windows Host:
   
Creat and transfer files from QNX Target to Windows Host  
Hello,

I try to create a text file through C-code. For this I used

fp = fopen("test_file.txt", "w");

After I executed the program (with some more code of course) I tried to find the file in the QNX System Information 
perspective but couldn't find it.

So I changed the code to

fp = fopen("/usr/test_file.txt", "w"); 

so that the file gets created in this location, but the execution through this error:

"Process 40985 (test_filesObraczka14030822252285) terminated SIGSEGV code=1 fltno=11 ip=01054134(/usr/lib/ldqnx.so.2@
fwrite+0xcc) mapaddr=00054134. ref=00000010"

Last but not least I tried to change the code into

fp = fopen(QNX_Target:/usr/test_file.txt", "w");

The execution went without any error but when I looked once again in the QNX System Information perspective there wasn't
 a file in there.

I didn't change any properties so I don't know if I have permission to write into the filesystem, so I add a pic of the 
filesystem for further information (there are the permissions as well but I don't know what they mean).

I hope you can help me.

Yours sincerely
Adrian
Attachment: Image filesystem.png 21.94 KB
Re: Creat and transfer files from QNX Target to Windows Host  
If you haven't found the solution yourself:
What kind of target do you have?

With my beaglebone target i have to create my files either in /tmp/ or on the SD-Card, as my other filesystems are not 
writeable.

Your code looks good. I create my files with something like that:

void logfile_create(char* path){
	assert(path);
	//file existance shall be checked before calling this function
	printf("File \"%s\"will be created now.\n",path);
	FILE* fp = fopen(path, "a+");
	fclose(fp);

}
Re: Creat and transfer files from QNX Target to Windows Host  
Thank you for your answer but I was able to find a solution for the problem (well it was quite easy in the end)

Yours sincerely
Adrian