I have a Book1.csv file.
It contains list like this:
bones, origin ,deep or superficial,location,action
Now, how can I search a bone, if user enters the action.
Create a class 'bone' with the traits described in the list. Read the file in and create instances of the class 'bone' as elements in a vector of bones. give the class 'bone' a query method that returns true if passed the name of an action it can do.
Once you've done all that you'll able to write an algorithm that gets the name of an action and goes through the vector listing all bones that return true for the query method..
The file does not drag into the command window. Can I tell the user to enter the name of the file? The file will be exactly the same name and content on any computer I need it in. So, isn't there a way for the .csv file to be simply read, instead of having to drag it or asking user for it.
You can do it the way that you first tried, but I've found that while working on the project (I use Visual C++ 2010) if I put the file in the project folder (the one that contains the project source code and header files ) it will open it just fine. When I finish the program, I just put the input file in the same folder as the copied .exe release version of my program and it reads from it just fine.
so use inStream.open("Book1.csv");
but make sure that Book1.csv is in the folder with your source code instead of the desktop and see if that works.
I'm not sure if it's the same for every situation but that's what works for me so far.
The thing though is that I am not sure where my teacher will have the "Book1.csv" file saved and my program saved on the same folder. I thought reading a .csv would be simple as reading .txt file. Is it not?