|
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)
|
|
|
|
|
Thanks Rajkumar_R,
Your reply is great! Your samples verified one thing, in C++ compiler does not distinguish reference and object type itself. Right?
regards,
George
|
|
|
|
|
Rajkumar_R wrote: const Outer::Inner * innerObj = (const Outer::Inner * )(OuterObj);
This does not compile.
Rajkumar_R wrote: const Outer::Inner * &innerObj = (const Outer::Inner * &)(OuterObj);
This compiles, but the member operator function is not invoked.
My modification below.
class O
{
public:
class I
{ } m;
const I* operator &() {
printf("const I* operator & \n");
return &m;
}
};
void main()
{
O v;
const O::I* p = &v;
}
Output:
const I* operator &
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: This does not compile.
What man you are not passing the reference to pointer rather you passing the pointer that is why it is not compiling
Maxwell Chen wrote:
class I { } m;
const I* operator &()
{
printf("const I* operator & \n");
return &m;
}
I guess what will be your implementation for the typecast operator from the above code
public:
class I { } m;
operator const I* &()
{
printf("const I* operator & \n");
return &m;
}
here you are not returning the reference you are returning the pointer, if you modify it as
class I { }
const *m;
operator const I* &()
{ printf("const I* typecast operator & \n");
return m;
}
it will compile
Maxwell Chen wrote: This compiles, but the member operator function is not invoked.
This i agree
|
|
|
|
|
Rajkumar_R wrote: class I { } const *m;
operator const I* &() {
printf("const I* typecast operator & \n");
return m;
}
My modification below.
class O
{
public:
class I
{} const* m;
O() : m(new I()) {}
operator const I* &() {
printf("operator const I* & \n");
return m;
}
};
void main()
{
O v;
const O::I* &p = v;
const O::I* &q = (const O::I* & )v;
}
Maxwell Chen
|
|
|
|
|
So now you can compile without error
|
|
|
|
|
Rajkumar_R wrote: So now you can compile without error
Yes!
Maxwell Chen
|
|
|
|
|
Hi Experts,
I want to add my command at the right click of file and folder. So I have to make some changes in registry entry. Could anyone tell what steps to follow?
I do not have any idea of shell menu.
Regards.
Pther
|
|
|
|