Hi All
Please any one can help me to complete my code !
My code is about opening file as binary and edit it
#include <iostream>
#include <iostream>
using namespace std;
int main(){
fstream nfile;
nfile.open("new .txt",ios::in|i os::out|ios::bi nary);
nfile.seekp(2);
nfile<<"code";
return 0;
}
my main problem is:
I need to insert my text in file after the position that i have set pointer on it
but
without replacing any data from file
Ex:.
if the file have string:
EGYHK.COM
i want this text be (EGcodeYHK.COM)
but when i run my code.. it's delete any characters after starting pointer place
i got it:
EGcodeCOM
not
EGcodeYHK.COM
sorry im not so good in english
i hope that i explained my mean
I Want To Put String Not Write it above the existing string in the file
Thank You
Please any one can help me to complete my code !
My code is about opening file as binary and edit it
#include <iostream>
#include <iostream>
using namespace std;
int main(){
fstream nfile;
nfile.open("new .txt",ios::in|i os::out|ios::bi nary);
nfile.seekp(2);
nfile<<"code";
return 0;
}
my main problem is:
I need to insert my text in file after the position that i have set pointer on it
but
without replacing any data from file
Ex:.
if the file have string:
EGYHK.COM
i want this text be (EGcodeYHK.COM)
but when i run my code.. it's delete any characters after starting pointer place
i got it:
EGcodeCOM
not
EGcodeYHK.COM
sorry im not so good in english
i hope that i explained my mean
I Want To Put String Not Write it above the existing string in the file
Thank You
Comment