Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - About File I/O: (8 Items)
   
About File I/O  
Hi all,

I am trying to do file operation in QNX Momentics IDE on windows XP and as a server i have QNX RTOS in VMWARE.
I am just trying to do normal file operation.When i create the file in working directory on windows and try to read the 
file i could not able to read the file.If i check the errno i get the message as "no such file or directory". This also 
happens in when i try to create a file and write into it.  

Pls guide me in this matter...
RE: About File I/O  
I`m confuse,even if QNX is running in vmware it doesn`t have access to the Windows filesystem unless you use something 
like fs-cifs.  Is that what you are trying to do?

> -----Original Message-----
> From: Sreesha AG [mailto:community-noreply@qnx.com]
> Sent: December-17-08 4:13 AM
> To: general-ide
> Subject: About File I/O
> 
> Hi all,
> 
> I am trying to do file operation in QNX Momentics IDE on windows XP and
> as a server i have QNX RTOS in VMWARE.
> I am just trying to do normal file operation.When i create the file in
> working directory on windows and try to read the file i could not able
> to read the file.If i check the errno i get the message as "no such
> file or directory". This also happens in when i try to create a file
> and write into it.
> 
> Pls guide me in this matter...
> 
> 
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post18800
> 
Re: RE: About File I/O  
No i am not doing as you said.I am just trying to open a file and read it.
Re: RE: About File I/O  
> No i am not doing as you said.I am just trying to open a file and read it.

You said "When i create the file in working directory on windows", that tells me you created a file on the windows disk 
( not on the filesystem of the QNX virtual machine ) "

Then you said "If i check the errno i get the message as "no such file or directory"".  That tells me you ran a QNX 
program which obviously is running inside the VMWare virtual machine.

Can you post your code. 



Re: RE: About File I/O  
#include <stdio.h>

int main()
{
      FILE *fp;
      char c;
 	  	    	
      fp = fopen( "ReferenceProj.dat", "r" );

      if (fp!= NULL) 
     {	   			
      	while( (c = getc( fp )) != EOF ){
         	putchar(c);
                }
      }
      else
      {
                 perror( "Unable to open file" );
       }
     fclose( fp );
}
	
This is my code,i have created file on windows disk.
Re: RE: About File I/O  
> #include <stdio.h>
> 
> int main()
> {
>       FILE *fp;
>       char c;
>  	  	    	
>       fp = fopen( "ReferenceProj.dat", "r" );
> 
>       if (fp!= NULL) 
>      {	   			
>       	while( (c = getc( fp )) != EOF ){
>          	putchar(c);
>                 }
>       }
>       else
>       {
>                  perror( "Unable to open file" );
>        }
>      fclose( fp );
> }
> 	
> This is my code,i have created file on windows disk.

That's the problem.  The file has to be on the Neutrino system.  The Neutrino system does not have access to the Windows
 filesystem.  When you run your application it runs on the Neutrino system and knows nothing about Windows.  

Windows is the host.  It is where you write your code and do your compiles.  Your Neutrino target is where the code must
 run, and therefore is where the file must exist.

Try this, log in to the Neutrino system as root.  Then "cd /".  Now do "find ReferenceProj.dat".  Post that output here.
 

Thanks,
Rodney

Re: RE: About File I/O  
Thank you for helping me.
Re: About File I/O  
If you are trying to get your QNX virtual-machine to perform file I/O for then your file will have to be copied into the
 working directory of your virtual-machine NOT into a Windows folder.

In your Momentics IDE open the view "Target File System Navigator" and, in the left-hand-side pane find the 'tmp' folder
 and click on it.

The contents of this folder will show in the right-hand-side pane. This folder is where your executables are put, and 
also any other files you are wanting to use such as 'config files' etc.

Copy your file to here and then your QNX virtual-machine will be able to find and access it.

Regards,
Nick