Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » simple find and deleat notepad program
Closed Thread
Old 04-25-2006, 04:59 AM   #1 (permalink)
 
Newb Techie

Join Date: Aug 2005

Posts: 20

hargi22

Default simple find and deleat notepad program

hi, is there a way of using vb or #c to deleat lines from a notepad file
i have a long list in a txt format that contains something similar to
programs/folder/folder
16/4/04 index.html
16/4/04 home.htm

Programs/folder/otherfolder
16/5/04
ect

I want to deleat the lines with the dates on for the entire file but leave the programs/folder/folder bit in
any ideas
i know i can use find and replace in notepad but is there a way of finding on a line if theres a number deteating the entire line?
TIA
hargi22 is offline  
Old 04-26-2006, 06:59 AM   #2 (permalink)
 
Super Techie

Join Date: Jun 2005

Posts: 274

mgoldb2

Default

here a simple C++ program I wrote in about 5min

It takes information from input.txt if the line does not start with a number it put it in output.txt

the result is output.txt contains only the lines that dont start with numbers.

Code:
#include<iostream>
#include<fstream>
#include<iomanip>
#include<string>
#include<cctype>

using namespace std;

int main()
{
	ifstream Input;
	ofstream Output;
	char record[81];
	
	Input.open ("input.txt");  
	
		if(Input.fail( ))
		{ 
			cout << "error opening input file" << endl; 
		}
	
	Output.open("output.txt"); 
	
	if(Output.fail( )) 
	{	
		cout << "error opening output file"<<endl; 
		return 0; 
	} 

	Input.getline(record,81);

	while(Input)
	{
		
		if(!((record[0]>=48) && (record[0]<=57)))
		{
			Output<<record<<endl;

		}
		Input.getline(record,81);
	}

return 0;



}

mgoldb2 is offline  
Old 04-26-2006, 11:28 AM   #3 (permalink)
 
Newb Techie

Join Date: Aug 2005

Posts: 20

hargi22

Default

Thank you
hargi22 is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On