Change directory from ROOT (C++) - c++

I want to change the directory of ROOT to analyse a dataset in a certain project file. ROOT is stored here "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ROOT 6.16.00". The data in the project file I want to access are in "C:\Users\aaa\Desktop\Project". How can I change the directory?
I have tried:
gSystem->cd("C:\Users\aaa\Desktop\Project");
but this does not work. The error which appeared was
\U used with no following hex digits
" use of undeclared identifier 'cd' "

Related

How to redirect FileListAbsolute.txt to another folder

I have an MS Build set up to build C++ projects which is configured with file path length as 260 characters. A few of my projects are having long target names which were failing with
MSB3491: Could not write lines to file Path: x64\Release\{targetname}vcxproj.FileListAbsolute.txt exceeds the OS max path limit.The fully qualified file name must be less than 260 characters.
I have redirected the output path and intermediate path a few levels up to the project folders and all the targets are generated without causing the above mentioned error except for FileListAbsolute.txt.
I am unable to redirect FileListAbsolute.txt and it is always created inside default path (projfolder\platform\configuration).
How can I redirect FileListAbsolute.txt to another folder few levels up to the project folder where other intermediate files are generated?
Edit:
Additionally, FileListAbsolute.txt is generated with 0KB size.
if we cannot move this file to any other folder, how can I block generating this file?

I have changed the folder name containing my django project now I'm getting "OSError"

I have accidentally renamed my main folder containing django project and all the files now when I run the 'runserver' command I get the following traceback
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: ''.
I even have changed the folder name back to original but I still am getting the same error.
Here is the link to complete error http://dpaste.com/2A30W6X
P.S. 'runserver' command was working fine before altering the name of the folder.
Django have some restrictions to create projects in concern with the name, If i'm remembering right you can only use '_' as separator and any special caracter is allowed.

IF EXIST outputs true on non-existent file

IF EXIST %PROGRAMFILES%\Winamp\paths.ini ( REM do stuff )
This file (and the folder) DOESN'T exist but it outputs true.
The script is on "K:\" and eventually got started with another file (%1) which as far as i know changes the start directory.
I have no clue why this doesn't work.
Also i tried to navigate to %PROGRAMFILES% and check the existance of \Winamp\ but for some reason it stays at it's home directory (or the one of %1).
You probably need quotes around the path, because %PROGRAMFILES% is going to expand to C:\Program Files
IF EXIST "%PROGRAM%FILES%\Winamp\paths.ini%"
e.g. Without quotes, note how it shows "file not found" TWICE:
C:\Users\marc>dir %PROGRAMFILES%
Volume in drive C is Windows7_OS
Volume Serial Number is 0E31-0E35
Directory of C:\
File Not Found
Directory of C:\Users\marc
File Not Found
because it was interpreted as
dir C:\Program Files
which executes as
dir C:\Program
dir Files
With quotes, it works:
C:\Users\marc>dir "%PROGRAMFILES%"
Volume in drive C is Windows7_OS
Volume Serial Number is 0E31-0E35
Directory of C:\Program Files
18/07/2014 04:02 PM <DIR> .
18/07/2014 04:02 PM <DIR> ..

VC++ VS2013 project not compiling after moving from non- version control folder to a version control folder

Hi I've a a solution (VS2013, vc++) which has 4 projects (*.vcproj) &
each of them being a EXE project. This is saved in a non-source version
control location in my win8 machine:: Say in
"Documents/NoSourecControlFolder/"
All the projects are compiling fine here.
Now, I moved this "" folder from the non source version control
location to a source version control location "perforce" say "
Documents/P4_workspaces/WorkspaceABC/".
I see that 1 project of out 4 projects in this *.sln doesn't compile fine.
Instead it throws an error like this & doesn't even start compilation ::
1>------ Rebuild All started: Project: ProectABC, Configuration: Release Win32 ------
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4341,5): error MSB3491: Could not write lines to file "Release\ProectABC.vcxproj.FileListAbsolute.txt". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
The errors says that the file name is too long, but the very same project was compiling perfectly fine in another non-source control location. Also I don't find this file "Release\ProectABC.vcxproj.FileListAbsolute.txt" anywhere.
After refering to this link I got a hint that this has something to do with the change in location of teh file.
Link
Any help would be really helpful. Thanks.
When you changed the location of the source you may change the size of the path of the root directory, example:
If origin source location was: C:\A\B (path size 6) and you moved or copied to C:\D\E\F\G (path size 10), you are adding 10-6=4 characters to all the path of files in the source, if you previously have a file with path length 258 and add the new 4 would exceed the limit (260). So before there is no problem compiling and now the limit is reached.
Check what is the length of the path to the reported file Release\ProectABC.vcxproj.FileListAbsolute.txt

How to write data into a xml file inside the folder in opencv?

I am using the opencv to write / read some data from the file. Here is the structure of my code and the config file.
/src/test.cpp
/src/config/FrameDifferenceBGS.xml
The code is
CvFileStorage * fs = cvOpenFileStorage(".config/FrameDifferenceBGS.xml",0,CV_STORAGE_WRITE);
cvWriteInt(fs,"enableThreshold",21);
cvReleaseFileStorage(&fs);
This doesn't work. I was given the same error for
' OpenCV Error: Null pointer (Invalid pointer to file storage) in cvWriteInt, file /home/winawer/Downloads/opencv-2.4.9/modules/core/src/persistence.cpp, line 2964
terminate called after throwing an instance of 'cv::Exception'
However, if I change to file to the same level with the source code,
/src/test.cpp
/src/FrameDifferenceBGS.xml
and
CvFileStorage * fs = cvOpenFileStorage("FrameDifferenceBGS.xml",0,CV_STORAGE_WRITE);
This works.
so my question is how to write the data into a file which is on a different level with the source code ?
Solution:
Now I figure out the solution, which I should put the config folder in the project debug folder rather than the project source folder
You are missing a /:
CvFileStorage * fs = cvOpenFileStorage(".config/FrameDifferenceBGS.xml",0,CV_STORAGE_WRITE);
should be
CvFileStorage * fs = cvOpenFileStorage("./config/FrameDifferenceBGS.xml",0,CV_STORAGE_WRITE);
You get the null pointer error because cvOpenFileStorage() fails as there is no directory called .config
If you want to use the relative path, the correct format is:
"./config/FrameDifferenceBGS.xml"
or
/config/FrameDifferenceBGS.xml
Now, you should know the base (root) path for this relative path. As I know relative paths are relative to the Output Directory.
If you work in debug mode, your project output directory is Debug folder, otherwise it is Release folder.