View Single Post
Old Nov 28th, 2005, 12:36 AM   #3
Kilo
Expert Programmer
 
Kilo's Avatar
 
Join Date: Nov 2005
Location: In Pink Clam?
Posts: 542
Rep Power: 0 Kilo is an unknown quantity at this point
Send a message via AIM to Kilo
lol that should have been obvious to me O_o. It worked Thanks!


next question: making the file name to open variable it irritating!

this is my current code just for BETA.

#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>

using namespace std;

int main()
{
	char ch;
	string s_fileIn;
	int  i_startOfLine=0,i_emptyCount=0,i_currLine=0;
	bool t1=false,t2=false,t3=false;

	cout << "file name to scan?";
	getline(cin,s_fileIn);

	ifstream FileIn("70271.txt");
	ofstream FileOut("dump.txt");

	FileOut << "  File Dump for ()" << endl;
	FileOut << "======================" << endl;

	while(!FileIn.eof())
	{
		FileIn.get(ch);
		
		if(i_startOfLine==3 && ch==',')
			t1=true;
		if(i_startOfLine==6 && t1==true && ch==',')
			t2=true;
		if(i_startOfLine==9 && t2==true && ch==',')
			t3=true;

		if(t3==true)
		{
			FileOut << "Line(" << (i_currLine+1) << ")=empty record" << endl;
			i_emptyCount++;
			t1=false;t2=false;t3=false;
		}
				
		if(ch==(char)10)
		{
			i_currLine++;
			i_startOfLine=1;
		}
		else
		{
			i_startOfLine++;
		}
	}

	return 0;
}

EDIT:
i cannot remember the process to taking user input and storing it in a string
__________________
"When in Rome, Do as the Romans Do"
"Beauty is in the eye of the BEER holder"
"Save your breath your going to need it for your blow up doll later"

SearchLores.org
Kilo is offline   Reply With Quote