Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete char from input file

Status
Not open for further replies.

prpleprncs

Programmer
Jul 12, 2002
14
VG
Is it possible to delete character from an input file once they are read.
 
Try to copy your file ( say: "original.txt" ) one caracter at a time to another file ( say: "copy.txt" )
while copying the original file to "copy.txt" if some caracters from the original file are equivalent to the caracter that you want to erase,copy the space caracter instead to "copy.txt".
 
that may not work. the character are 'bits'. all 0's and 1's. what i did do was instead of copying to a diff file like i was, i simply put them in a buffer and started reading from the last place i left off. then overwrote the buffer. this works.
but let me know if you come up with another way
 
Ok i have found something !
I'm not sure if this is going to work in your example since you are using "bit caracters" but it should work with "text files".

Copy your file to another one.While copying the file if some caracters matchs the one that you want to erase,do nothing.
 
nope won't work. tried that. the 0's and 1's are random. plus i have to have data integrity because i have to convert to decimal once conditions have been meet concerning whether or not the bit is 1 or 0.

i used this:
while (finAllBit>>b)
{
bits[a]=b;
a++;
if(a>304)//only want 304 at a time
{
cout<<bits[5]<<endl;
a=1;//this resets the index and overwrites old with new
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top