C++ File read Programming Software Development by Dudearoo **Dudearoo** *Useing Code::Blocks* Heys you guys! ive got a question, … its possable to read a file name like for example dudearoo.dat and output the name ive got an idea for… How Do i Parse??? Programming Software Development by Dudearoo **Dudearoo** *Useing Code::Blocks* How do i Parse??? Can you guys … File Named Settings =============================== Settings.Config--------------------------------------------- --- TXTFont=16px BKCLR=Black Username=Dudearoo // As A Comment Settings.Config-----------------------------------------End --- I want to Be… While loop issue, Programming Software Development by Dudearoo **Dudearoo** *Useing Code::Blocks* Hey you guys. ive got a problem, … How do i output the current time? Programming Software Development by Dudearoo **Dudearoo** *useing Code::Blocks* Hey you guys! I've got an … FILE I/O closeing prematurley Programming Software Development by Dudearoo **Dudearoo** *Useing Code::Blocks* Hey you guys! ive got a problem … FILE I/O .txt read ERROR. Programming Software Development by Dudearoo **Dudearoo** *Useing Code::Blocks* ok, ive got a somewhat simple error … C++ Find string and print After Programming Software Development by Dudearoo **Dudearoo** *Useing Code::Blocks* Hey Guys! ive got a question, How … Are Programs Dependt on There Library's? Programming Software Development by Dudearoo **Dudearoo** *Useing Code::Blocks* Are Programs Dependt on There Library'sI'… Re: C++ File read Programming Software Development by triumphost I don't know if you mean reading the file's name? OR whether you mean reading data from the file and outputting a list of names from the data. //Read a file's contents and output it to a string. For your purpose, you can even use GetLine which I have not demonstrated. #include <iostream> #include <fstream>… Re: C++ File read Programming Software Development by Dudearoo what i want is to read the files name and input it to a char(Char's i know) Re: C++ File read Programming Software Development by Dudearoo the .dat is binary, so i need to know the files name to know the players name. help Please? Re: C++ File read Programming Software Development by Dudearoo in other words the first one you asked me :) Re: C++ File read Programming Software Development by triumphost Ahh well in that case that's a bit different. Do you know the location of the file? If so then you can just search the directory for the files: From MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365200%28v=vs.85%29.aspx That's a very good example. Of course you can simplify it and put the found names into a char* buffer if you … Re: C++ File read Programming Software Development by Dudearoo WHO, WHAT? triumphost could you please simplfy for me please. ive almost got it #include <iostream> #include <windows.h> #include <string> #include <fstream> using namespace std; int main() { char filesource[250]; ifstream myfile (" " << filesource[250] <… Re: C++ File read Programming Software Development by Dudearoo Oh and yes i do know the file location Re: C++ File read Programming Software Development by triumphost 1. You cannot do:` cout<<CharIdentifier[250]`... You have to do `cout<<CharIdentifier`. 2. Not sure if you understood me :S but my laptop is about to die so I'll post what I wrote: #include <windows.h> #include <iostream> #include <vector> using namespace std;… Re: C++ File read Programming Software Development by Lucaci Andrew Have you checked this site? http://www.cplusplus.com/forum/unices/9187/ I'm not sure if this would work. #include <fstream> #include <iostream> #include <iterator> #include <string> #include <vector> using namespace std; int main(){ string filename; cout<<"File … Re: How Do i Parse??? Programming Software Development by NathanOliver Well I know you want someone here to teach you but I dont see the point if there are perfectly good lessons somewhere else. http://www.cplusplus.com/faq/sequences/strings/split/ has a very good tutorial on how to accomplish what you need. I would suggest try using what is there and see what you come up with. If youy still need help post the code… Re: How Do i Parse??? Programming Software Development by rubberman Look at the patterns. Each parameter in the config file has an '=' sign in it. The part before the '=' is the parameter, and the part after is the parameter value. So, do this. 1. Read line into buffer. 2. Check for comment character ('#') 3. if no comment, look for '=' using strchr(buffer, '=') 4. if return value from strchr is not null, you now … Re: How Do i Parse??? Programming Software Development by Dudearoo Um, first ill go to rubberman, i want my buffer to be a String(Sorry I should have said something :)) so i dont have to worry about the possable Character Length, possabley if you can show me a diffrent way for 3.? The other two i've got(Comment Read). Second, NathanOliver Maybe if you could Explain In more Detail the way of the "Split The … Re: How Do i Parse??? Programming Software Development by WaltP Look up the **methods** in the `string` class. The methods for searching, splitting, and all that stuff are well documented. Re: How Do i Parse??? Programming Software Development by Dudearoo Can you tell me more detailed places to go? The Answers are great in all but i just want to know WHY I NEED TO KNOW this. :) Re: How Do i Parse??? Programming Software Development by WaltP [Sure](http://lmgtfy.com/?q=string+C%2B%2B) Re: How Do i Parse??? Programming Software Development by Dudearoo Can somebody Tell me another Way then strchr, Due to useing Chars, NOT C++ String, i cant use them for what i want. Thanks, Re: How Do i Parse??? Programming Software Development by ravenous Since you mentioned Boost, have you looked at [Boost program_options](http://www.boost.org/doc/libs/1_51_0/doc/html/program_options.html)? It has a nice syntax for parseing these kind of files. Lots of the tutorials on the site are about using it to parse command line arguments, but the is a section about parsing config file [here](http://www.… Re: While loop issue, Programming Software Development by VernonDozier Indent your code. It's impossible to read. Are you sure you aren't missing bracket(s)? Why is there are a "return 0" at the bottom of the while loop? Why does the answer "yes" have a "break" statement in it? I thought "no" was supposed to break the loop from your description. Re: While loop issue, Programming Software Development by rubberman You have an explicit return before the end of the loop, so there is no looping going on. All of what VernonDozier said goes double for me. Re: While loop issue, Programming Software Development by Lucaci Andrew Why don't you use like this: #include <iostream> #include <string> using namespace std; int main(){ int repeat = 2; string answer; while (repeat != 0){ cout << "Insert yes or no: " << endl; cin>>answer; if (answer == "no" or answer == "No" … Re: While loop issue, Programming Software Development by Dudearoo sorry guys return0; is supost to be after terminating loop and i will start to indent my code :) lucaciandrew your code is not clean enough, i want to type no to have the loop continue, yes to stop it. and pressing enter a few times? I would like just one time :) Re: While loop issue, Programming Software Development by Dudearoo I still would like some help on the loop end, if i type yes repeat = 0; weird dosent work? could you please help me fiqure out the problem here thanks.