Is there a way to change what a relative path is referencing after runtime has started?
My specific issue is that I have several existing 100,000+ LOC lua projects. I am building a new back-end in C/C++ for this by wrapping a Lua C library. The lua scripts use io.open("./path/relative/to/project/file") which translates to fopen(...) in C. The project file which this is relative to is opened by the user after the application has started.
I see two solutions, neither are particularly good:
1) Change every io.open() function in every project to be relative to a static location. I lose all flexibility if I do this.
2) Modify the Lua library to prepend a custom path to opened files. Modifying 3rd party libraries suck because you can't update the library without tracking patches.
3?) Ask cplusplus forum if there is a way to change the relative directory.
I have my application database in the AppDataRoaming folder. I'm trying to create a connection string for Telerik reporting, up until now I've had a connection string in a settings class that is put together like this:
The path is:
data source=C:UsersSynlightAppDataRoamingAppNamedataAppDB.sqlite
How it make it work for my project. Runtime means I am going to have to give the path at the command line?
Here is how I have to run it, so I can test it against the example inputs and outputs they give us to test our program. I am using putty. Already crated the folders inside my project folder, but don't know how to implement it on my source code.
Code: class A { std::map<std::string, Unit*> aMap; class B
[Code] .....
This code snippet results in "A non-static member reference must be made relative to a specific object". When I make callA() static, this error goes away, but there is problem with aMap.
I am trying to open a file and print the contents of the file to the terminal window. It works when I put the file right in the directory with the Solution but not if the file is out on my desktop and I use the full path. Here is the code:
#include <iostream> #include <fstream> #include <string> using namespace std; int OpenFile(){ fstream SampleFile;
Is there any way in sfml version 2 that I can get objects in a graphics window to retain there relative positions and sizes when the window is resized? I have tried looking in the documentation for version 2 but with no luck.
As an example suppose the window is 800x600 and there is a line running right across the window at 3/4 of the way down (i.e at y=450). If the window is then made larger say 1280x1024 how would I keep the line in the same relative position (i.e all the way across 1280 and 3/4 of the y setting down).
How to get relative memory address of members of Class or Structure ? I want to auto scan the members of Class/Struct, and show the address/value like the "watch window" in debug mode of popular C/C++ IDE software.
For a while, I have been running a Windows 7 Visual Studio 2012 CPP project fine. However, today, all of a sudden, it has stopped being able to read any header files that are in relative directories. I cannot think what I have done to make this happen.
It seems to be an issue with Visual Studio as a whole, rather than my individual project, because I have created a new simple project and I am having the same problem. So, I have a CPP project at `C:/Projects/TestProject`. Then, I have a header file called `test_header.hpp`, which is located at `C:/Headers`. In `TestProject`'s project settings, I have added the directory `../../Headers` to `Additional Include Directories`. Then, my main functions is as follows:
Code: #include "test_header.hpp" int main() { return 0; }
Which gives me the error:
Code: Error1error C1083: Cannot open include file: 'test.hpp': No such file or directoryc:projects estprojectmain.cpp11TestProject
Is there some global Visual Studio setting that is responsible for setting up these relative directories? Just in case the relative directory was not correct, I also tried a load of others, such as `../Headers` and `../../../Headers`, but these gave the same errors.
I got a little question about getting the data path of my c program. I heard something like it's already given in the "int main(int argc, char **argv)". But with witch function can I get it?
For example: The program is called Pathfinder and the path is 'D:Path1Path2Pathfinder.exe'.
I wanted to make my program read the file "input.txt". I did it successfully, but now I want to get the full path of the file "input.txt". Is there any way to do it?
basically I need to list all of files and subfolders and files inside them etc till all paths has been inspected, read data from every single object and pack it all into a single file.
I did not want to use boost or minizip because it seems too much for something so easy so I just wrote it myself via dirent - everything works fine I just have problem with directories and files with non ANSI character in titles (I'm from Poland) like ąęoźż etc. I can open them without problem and read all data from them but when I pack their's filename to std::string - it gets corrupted and happend to be for example:
TEST~1 instead of TESTąę
Just a note that data inside files is being written without problems - all special characters are stored without problems.
The following code writes to a file on either local disk to a remote disk (commented out code) on Windows 7 platform.
Code: #include <iostream> #include <fstream> using namespace std; int main () { ofstream outfile;
[Code].....
The documentation does not specify what is a valid filename (path and filename). For example, will the "\server emp" path work on all operating systems to access a samba share? Does the constructor accept forward and backward slashes as folder separator on all operating systems?
im trying to write a file to a default document folder..something like...
FILE* file; file = fopen("%docdir% est.txt", "w"); fputs("Hello", file); fclose(file); "%docdir% est.txt" this isnt working for me, i have to write it as "C:userspublicdocument est.txt"
any method to write directly to default document folder so it will work in most Windows ? for example in windows 7 this is the default folder "C:users publicdocument est.txt" in windows XP its different
i have to detect the windows version first, to write the correct path
I need to open a text file game_scores.txt and i can not figure out a way to.
#include <iostream> #include <string> #include <fstream> using namespace std; int main() {
[Code] ....
the code is used to read the text and take the first 4 pieces of info but i do not know how to do it. i have already created the text file and moved it into the source. i am using visual studios 2012. In 2010 the text file would show a relative path, it doesn't in 2012
This question is currently only for windows; but I would like to know about a cross-platform way to perform what I want to do (explained below) -
I have created a little program:
#include <iostream> int main(int argc, char *argv[]) { for (int i = 0; i < argc; ++i) { std::cout << argv[i] << ' '; } }
I have added this program to the windows PATH. I put this program in C:Program FilesProgram
I now navigate to C:DataVariousTexts using CMD.
Then I type in: "program x"
The program will print out "program x" as by default. What I would like to get hold of is the folder in which the program is actually being called. ( I want to somehow get "C:DataVariousTexts" to be read into my program ).
I need to append file path for some particular program. But the problem is when I append it like below, it gets error whether filepath seems to be C:/Users/My/Desktop/C++/1.txt
int i=1; stringstream str; str<<"C:/Users/My/Desktop/C++/"<<i<<".txt"; string filepath=str.str(); cout<<filepath; ifstream ipf(filepath); if(ipf) { do some thing...}
But if it was like this no error, program work as desired.
int i=1; stringstream str; str<<"C:/Users/My/Desktop/C++/"<<i<<".txt"; string filepath=str.str(); cout<<filepath; ifstream ipf("C:/Users/My/Desktop/C++/1.txt"); if(ipf) { do some thing...}
In my C++ program, lets call it menu.exe, I want the user to be able to run a specific program when selecting a specific menu, let's call this program cios.exe.
As the users of my program can have the cios.exe installed in any folder location, I need a way to first locate where the cios.exe is located and then start it with ShellExecute. My problem is : How do I find the path to where cios.exe is located in anyones PC as it can be installed it any folder location.
I am new to Path Finding so I just know BFS, DFS, Djisktra, and Basic A*
I've searched for a few multi agent pathfind paper here and there. But I can't seem to understand them..
I am path finding in a grid map, 4 ways neighbor movement
My map isn't so big it's 300 x 300 up to 400 x 400
Most of the map is open space, I would say that at worst case 4/5 of the map is open space.
And there is probably around 100 agents.
I've tried running BFS 100 times and it takes around 200ms on average
Changing BFS to A* which I am thinking right now will definitely cost lesser time
But are there better ways in doing this ? and also Does running Single Agent A* multiple times doesn't cause problem for other agent ? perhaps causes deadlocks ? ( Considering that the path that have been determine for agents before the current searched is considered blocked )
I have a comboBox that I created in XAML using using binding and I'm unable to get the selection. I've tried everything I could think of or find on, but no luck.
Here's the relevant XAML and C# code for the comboBox:
I was asked to find the longest path in a graph. I was thinking about using Dijsktra's algorithm after multiplying all the weights with -1 and run the program in normal way and find the shortest path. And then I'll multiply with -1 again and get the longest path. I think this should give me the longest path, do you think it would work? And also, I'm dealing with considerably big data, such as 1.000.000 nodes and many more edges. etc. and I have a time limit of 2 seconds and memory limit of 128mb. Any other data structure instead of Adjacency Matrix? Because I'm pretty sure it will exceed the limits.