[vtkusers] The filename+path in windows and linux

Winfried Bilgic 4Winne at web.de
Fri Jul 22 08:28:15 EDT 2005


you could use the c-function getenv("Your-System-Environment-Variable") to read your own system variable. Or you can read the system variable "OS" (Windows) to detect you are under windows and modify the path-format in windows style AND the system variable "OSType" (unix) to detect you are under linux and modify... so on...

Regards Winn

Leon Chen <liming.leon at gmail.com> schrieb am 22.07.05 03:18:54:

Hi everyone,

I am doing my project under windows(my laptop) and linux(the desktop
machine in school lab) using VTK.

In windows, I use MSVC++ 7; under linux, I just use the .cxx file,
ccmake it, then make, run. Since now there is only 1 cxx file, it is
quite straightforward to share the same source CPP source code between
these 2 different platform.

However, there are some problem.

First is the difference between VTK versions installed in the system.
It is troublesome because I have to modify some function to match the
different specification in different versions of VTK...

The second problem which is easier, and maybe I can get the answer here:

About the filename+path in different system.

When I use something such as

XXX->SetFileName( "G:\\Project\\Data\\04548d144.vtk" ); 

in windows, I can use '\\' or '/' as separator.

In linux, it should be 

XXX->SetFileName( "/homes/lc04/Project/Data/04548d144.vtk" );

Now I just want to keep the code exactly the same, so I need not
modify this line (or many similar lines) when the OS is switched.

I know I can use VTK_DATA env, but is it possible to use this system
env via the SAME code both in linux AND windows? If it possible, how
can i do it? I found some code, but there are different in win and

BTW, in tcl it is so easy, just use $VTK_DATA, problems solved. but in CPP...

hope someone who has the experience can reply me....

Many thanks!!!

This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:

More information about the vtkusers mailing list