Hello,
Thank you Faldrax for tips and help.
So.. here I am, this peace of code reads text step by step, symbol at a time, from file in.txt into out.txt.
Now I have a problem. What is arbitrary set subsequence "n" .. How does arbitrary instructed line looks like..
for example text file look like this :
1 2 3
|
FLAC is specifically designed for efficient
packing of audio data, unlike general lossless
algorithms such as ZIP and gzip.
|
I have to find out how such subsequnce can be defined... I am working on this.
update: I found out that It can be later added by User manually, so I have to find the line added by User and have to "cout" the line with it`s appropriate line number.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include <fstream>
#include <iostream>
using namespace std;
int main ()
{
char c;
fstream fin ("in.txt", ios::in);
fstream fout ("out.txt", ios::out);
fin.get(c);
while (fin)
{
fout.put(c);
fin.get(c);
};
fin.close ();
fout.close ();
system ("pause");
return 0;
}
|
update:
Ok, I figured out that the arbitrary instructed line will be typed into the program.exe window and the function should work like a search . If for example I type in "FLAC zip audio and other words." The program should store lines and their numbers which contains those words in other file.
Maybe I should use get.line instad of chars only?
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <fstream.h>
int main()
{
char str[2000];
fstream file_op("c:\\in.txt",ios::in);
while(!file_op.eof())
{
file_op.getline(str,2000);
cout <<str;
} file_op.close();
cout <<endl;
return 0;
}
|