How to create a VC program to read text
-
:((I am new to the field of VC++....can anyone please tell me as how to create a program that reads a text file, line by line....and if possible how to read each line starting from a particular character to a specified number(of characters)
-
:((I am new to the field of VC++....can anyone please tell me as how to create a program that reads a text file, line by line....and if possible how to read each line starting from a particular character to a specified number(of characters)
one place to start would be to look at msdn.microsoft.com for iostream and fstream. *.* cin >> knowledge;
-
:((I am new to the field of VC++....can anyone please tell me as how to create a program that reads a text file, line by line....and if possible how to read each line starting from a particular character to a specified number(of characters)
Consider using a CStdioFile for reading your file. Construct an instance of the class for the file you want to read from. You can call the ReadString method on it to get a line of text from your file into a CString. Then you can make use of all the methods of CString to get to only the part of the line in the string you are interested in. Technically you are reading the whole line. You then parse the string for what you need. Lorenz Prem Microsoft Corporation
-
one place to start would be to look at msdn.microsoft.com for iostream and fstream. *.* cin >> knowledge;
Hi! Keegan I realy don't understand what you wanted to say...was just going through what you told me , but to no avail.....
-
Hi! Keegan I realy don't understand what you wanted to say...was just going through what you told me , but to no avail.....
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang98/html/\_iostream\_fstream.3a3a.fstream.asp thats an insane description of fstream. I'll show you an example of one way to write to files here:
string filename = "data.txt"; //the name of the file we want to input from / output to ifstream inFile(filename.c_str()); //'sets up' input from a file ofstream Out; //sets up output to a file //input a word from a file: string word; inFIle >> word; //output that word to a file: Out << word;
ifstream and ofstream are more or less identical in terms of use to cin and cout. Once you define the input and output streams, they work the exact same way (more or less). If you have any more questions, feel free to email me. *.* cin >> knowledge;