|
|
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
|
|
|
|
|
George_George wrote: 1.
I think it means an operator &, which returns const Inner* type and takes no arguments, right?
I believe it is not an & operator returning const Inner* type, you can ensure this by writting code as follows
const Inner* pInner = &objOuter\\ object of Outer or the class within which the operator is defined
error C2440
The prototype of function that matches your guess will be
const Outer::Inner * operator &();
It is actually a type cast operator that type casts to const Inner *, const Inner * &, a reference to pointer to const Inner type object
Iam not sure about the volatile qualifier in the return type, I think it gives the caller of the function the detail that the returning reference variable is volatile
|
|
|
|
|
Thanks Rajkumar_R,
You mean convert from current type to const Inner * & type (a reference to pointer to const Inner type object), right?
regards,
George
|
|
|
|
|
Yes,
Let the Class Outer has the specfied operator
then if this typecast is applied to the Outer class object (current type is Outer), the specified operator function is called.
Outer OuterObj;
const Outer::Inner * innerObj = (const Outer::Inner * )(OuterObj);
or
const Outer::Inner * &innerObj = (const Outer::Inner * &)(OuterObj);
note the operator returns the inner object rather than binary interpretting the object in memory like C-style casting (power of operator overloading)
|
|
|
|