i m unable to extract data from one text files to different text files..i am able to concat two text files in d same file
---------- Post updated at 03:21 PM ---------- Previous update was at 03:16 PM ----------
i want a c program for it
i m unable to extract data from one text files to different text files..i am able to concat two text files in d same file
---------- Post updated at 03:21 PM ---------- Previous update was at 03:16 PM ----------
i want a c program for it
What have you tried so far? Where are you stuck? Mind that this a a support forum, where people voluntarily help you with any problems that you encounter, not work-for-hire forum.
i hav done dis with delimliter as file separator..
i want to implement it with file header..plz help with d same
my prgms for concat n extract.
concatenation
#include <string.h>
#include <fstream.h>
#include <iostream.h>
int main()
{
char line[100];
ifstream chapter_one("new1.txt");
ifstream chapter_two("new2.txt");
ifstream chapter_three("new3.txt");
ofstream book("book.txt");
while (!chapter_one.eof()) {
chapter_one.getline(line, 100);
book << line << endl;
}
book << "*" << endl;
while (!chapter_two.eof()) {
chapter_two.getline(line, 100);
book << line << endl;
}
book << "*" << endl;
while (!chapter_three.eof()) {
chapter_three.getline(line, 100);
book << line << endl;
}
book << "*" << endl;
chapter_one.close();
chapter_two.close();
chapter_three.close();
book.close();
return 0;
}
extract
#include <string.h>
#include <fstream.h>
#include<stdio.h>
#include <iostream.h>
#include<conio.h>
#include<ctype.h>
#include <string.h>
#include <fstream.h>
#include <stdio.h>
#include <iostream.h>
#include <conio.h>
#include <ctype.h>
int main(){
char line[100];
int k,l;
int count=0;
clrscr();
ofstream chapter_one ("new4.txt");
ofstream chapter_two ("new5.txt");
ofstream chapter_three ("new6.txt");
ifstream book("book1.txt");
while (!book.eof())
{
book.getline(line,100);
k=strlen(line);
//chapter_one<<line << endl;
for(int i=0; i<k; i++)
{ //cout<<line;
//printf("%d\n",line);
//l=toascii(line);
//cout<<l<<endl;
if(toascii(line)!=42)
{
chapter_one<<line;
count=count+1;
}
else
chapter_one<<endl;
//code for file seperation
} } cout<<count;
/*for(int i=0;
i<=256;
i++) { printf("%d %c",i,i);
} //book<<"*"<<endl;
/* while (! book.eof()) {
book.getline(line,100);
chapter_two<< line << endl;
} //book<<"*"<<endl;
while (! book.eof() ) { book.get
line(line,100);
chapter_three << line << endl;
} */ //book<<"*"<<endl;
chapter_one.close();
chapter_two.close();
chapter_three.close();
book.close();
getch();
return 0;
}
---------- Post updated 05-25-11 at 10:43 AM ---------- Previous update was 05-24-11 at 03:54 PM ----------
thank you very much pludi..
i have asked you for help..sending messages to anyone was not an issue