|
Hello to all,
in my project i have created one file "header.e01" through "CFile" class object and i wrote some data in it.Now i again created another file "header.e02" through "CFile" class only and i want to copy entire data from "header.e01" to "header.e02" rather i want to write total data in "header.e01" to "header.e02" through object of file "header.e01" means can i write object of file "header.e01" into "header.e02" file.can any body plz tell me how this can be done? it is urgent so plz can anybody help me?
Thanks and Regards,
Anay
|
|
|
|
|
I do not understand what you are writing!!!
you want to copy the WHOLE content of header.e01 to header.e02 ?
or
you want to copy PART of the content of header.e01 to header.e02 ?
IMO, if you can write the file, you can read it back and save it back again to another file.
|
|
|
|
|
AnayKulkarni wrote: ...i want to copy entire data from "header.e01" to "header.e02"...
So have you considered using CopyFile() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
AnayKulkarni wrote: rather i want to write total data in "header.e01" to "header.e02" through object of file "header.e01" means can i write object of file "header.e01" into "header.e02"
What do you mean by object of header.e01?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
AnayKulkarni wrote: means can i write object of file "header.e01" into "header.e02" file.
I quess your are talking with respect to object persistance (Serialization), You want to store the Object (CFile) State to the file 2 (header.e02) rather than copying the entire data.
I cannot trace the functions for this, I would suggest a solution.
overload the operators for Serialization,
CArchive& AFXAPI operator<<(CArchive& ar, CFile& fileObj)
{
ar << fileObj.GetFileName();
ar << fileObj.GetPosition();
return ar;
}
CArchive& AFXAPI operator>>(CArchive& ar, CFile& fileObj)
{
CString FileName;
ULONGLONG pos;
ar >> FileName;
fileObj.Open(FileName, 0);
ar >> pos;
fileObj.Seek(pos, 0);
return ar;
}
now you are able to store Cfile Object State through CArchive.
Eg:
CArchive archive(&File1, CArchive::store);
archive << File2;
please use the logic of above, there may be compile / runtime error, that depends on your implementation
|
|
|
|
|
i made CTreeCtrl backgruond color gradient
now i wanna know how to make the labes trasnperent so that white color background will not appear
please let me know
thanx in advance
|
|
|
|
|
Is this[^] article of any help to you?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I am not able to understand in that
i dont wanna do OnPaint
I am getting image as trasparent but the text next to image is not trasperent it shows white background how to remove the white background and put trasperent color
please help me out
|
|
|
|
|
hi all,
i have a problem working with a program in vista, this program made by myself is creating a file in the application path and writing some data in to the file, but when i try to run it in the vista its showing a exceptional error. I think its not allowing my application to write a file in to the installed path.
Can Anybody help me to sort out my problem?
||SnAkeBed||
|
|
|
|
|
Try this:
Right-click at the executable file, and choose [Run as Administrator] ...
Maxwell Chen
|
|
|
|
|
hi ,
it worked................... thanks a lot ................................
||SnAkeBed||
|
|
|
|
|
SnaKeBeD wrote: showing a exceptional error
I'm amazed!
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
It's [C0000005] access violation.
Maxwell Chen
|
|
|
|
|
SnaKeBeD wrote: this program made by myself is creating a file in the application path
You do know this is bad practice, right?
If you intend your app to be used by standard users, they
will have to enter a password every time.
There is proper places to create app data files, both common and per-user.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi friends..
i have one doubt with my project regarding with CFile ..how to write serial number in a file regarding with file size.
the file contains data like this ..
abs
der
con
foj
etc..
this is the file structure the output file like this only..
1.abs
2.der
3.con
4.foj
etc..
how its possible.?
Thanks
raju.k
|
|
|
|
|
raju.k wrote: i have one doubt with my project regarding with CFile ..how to write serial number in a file regarding with file size.
the file contains data like this ..
abs
der
con
foj
etc..
this is the file structure the output file like this only..
1.abs
2.der
3.con
4.foj
etc..
how its possible.?
???
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
He wants to insert a number at the beginning of every lines in a file.
Maxwell Chen
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
yes chen u r right ...
raju.k
|
|
|
|
|
Did you bother to check my previous reply[^] to you?
You can modify the present line in your file with CString::Format() and then use CStdioFile::WriteString() to write it to the file.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Your situation demands line by line access to a file resource. Please use CStdioFile instead of CFile. Here's your solution, which can be used right away:
CStdioFile csf;
CFileException cfe;
CString str, sTemp;
CStringArray csa;
int iSize=0, iVer=0;
if ( !csf.Open(_T("E:\\Some.txt"), CFile::modeReadWrite, &cfe) )
AfxMessageBox(_T("Failed to open the file"));
while(csf.ReadString(str))
{
sTemp = str;
str.Format(_T("%d. %s"), iVer+1, sTemp);
csa.Add(str);
++iVer;
}
csf.SeekToBegin();
iSize = csa.GetSize();
for(int i=1; i<=iSize; ++i)
{
sTemp.Format("%s\n", csa.GetAt(i-1));
csf.WriteString(sTemp);
}
csf.Close();
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I remeber back in Visual C++ 6 there were problems with ref-counted strings on multithreaded apps.
http://support.microsoft.com/kb/813810[^]
Now, this was said to be fixed in Visual C++ .NET and beyond. The question I have is how? Did they stop ref counting? Or come up with some clever implementation that still ref counts.
Anyone know? Reading the current STL code for basic_string makes me want to go blind.
|
|
|
|
|
|
Hello everyone,
The following code,
operator const Outer::Inner * volatile & ();
1.
I think it means an operator &, which returns const Inner* type and takes no arguments, right?
2.
Adding volatile to return value means?
(I previously only used volatile to qualify variable)
thanks in advance,
George
|
|
|
|