|
I just now tried to install the current free-download Visual Studio C++ Express Edition, and it refused, saying that it needed a later version of Windows than the version that I have (Windows Vista).
|
|
|
|
|
|
Yes, you need Windows 8 for using Visual Studio 2012 .
However you may install Visual Studio 2010 on your OS .
Veni, vidi, vici.
|
|
|
|
|
Visual Studio 2012 runs on Windows 7.
|
|
|
|
|
True, it runs on both Windows 7 and Windows 8. However it doesn't run on OP OS.
Veni, vidi, vici.
|
|
|
|
|
You could keep your ide and simply Google for resedit which is a compatible program that let's you edit resource files for visual studio projects. It is a bit tedious, but is a viable workaround which saves on a reinstall of visual studio, and you don't have to go messing with the project conversion wizard which pops up when using newer versions of v.s with older project files.
|
|
|
|
|
So far I have been looking in the manual and editing the .rc file in a text editor.
|
|
|
|
|
Continuation of previous thread, now that its topic has changed. With thanks for your advice, and I apologise for any misunderstandings.
I am writing a new program (named rebrmasks), using matter from a similar older program (named chekobjp_vc) that I wrote and it reached its final form in September 2009.
rebrmasks is to work on user-created character information files in my copy of the CGI package called Poser, and thus it must work on files in the C: area.
Link here to the Wikipedia page about Poser
(chekobjp_vc checks .obj file pointers. Here an .obj file is a map of vertexes and polygon faces in a CGI model. I adapted it from an older version that I wrote for my old Borland C++ 5.1 compiler.)
(rebrmasks is to add 2 more alternate-geometry links to rebreather diver CGI models' fullface masks. I have made CGI models of scuba divers and frogmen -- for free download, not for money.)
I find that rebrmasks refuses to obey the function rename(,) to rename a file :: errno says "permission denied". But chekobjp_vc, which is very similar, renames files in my C: area correctly.
When I am using Visual C++ to work on my rebrmasks program, please, is there something which I can reset to tell it to compile a program which has the privilege to move files in my C++ area?
modified 21-Jan-13 1:22am.
|
|
|
|
|
maybe your program have some left open pointer to this file?
an opened file can't be renamed in windows!
My programming get away... The Blog...
Taking over the world since 1371!
|
|
|
|
|
I just found that I had fopen()'ed the same file twice without fclose()'ing it between. The offending rename(,)'s now work OK. I am sorry to take up so much of your time.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I just now inserted into my program this instruction:-
i=rename("C:\\Poser4\\Runtime\\Libraries\\character\\Divers\\Divers_rebreathers\\CDBA\\miaow.txt",
"C:\\Poser4\\Runtime\\Libraries\\character\\Divers\\Divers_rebreathers\\CDBA\\wuff.txt");
to rename a file which I had just created and the program never opens it. And the rename went OK.
The file that I was trying to rename it before :: I had fopen()'ed it in read mode, and read from it, and then fclose()'ed it; after that I tried to rename it, and that rename was refused.
modified 21-Jan-13 6:14am.
|
|
|
|
|
Good on you! ^^
Good luck with your work...
My programming get away... The Blog...
Taking over the world since 1371!
|
|
|
|
|
hi
Here is my problem:
I don't understand why in the following code the second line is error and the third is ok.
In the first case where the error is I will get a copy and in the second reference to the pointer.
Why the reference is considered l-value?
class Node {
private:
int key;
Node* left;
Node* right;
typedef Node* Link;
public:
Node() { key=-1; left=NULL; right=NULL;};
void setKey(int aKey) { key = aKey; };
int Key() { return key; };
Link Left() { return left; };
Link& Right() { return right; };
};
int _tmain(int argc, _TCHAR* argv[])
{
Node *p= new Node();
p->Left()= new Node();
p->Right()= new Node();
return 0;
}
modified 20-Jan-13 8:56am.
|
|
|
|
|
Left() returns a Link ; and Right() returns a Link&
Nihil obstat
|
|
|
|
|
You code makes no sense, you are trying to set values into functions. The functions Left() and Right() are called to return the values of those pointers. You should be using the Node pointers left and right ; although you have made them private so you cannot as the class stands. Either make them public, or provide setter functions for them.
|
|
|
|
|
Yes, of course.
Still, I am interested to know why the code does not work with both cases, or why only in the second case;
void setLeft(Node* l) { left = l; };
Also notice if I do, it works:
Node *r= p->Left();
r= new Node();
Maybe because in the second case it references directly a l-value by reference
and in the second it uses a copy to a pointer?
|
|
|
|
|
|
If you do
Node *r= p->Left();
r= new Node();
p->left is still NULL afterwards, because you copied the (NULL) pointer and assigned the allocated object to the copy.
If you do
p->Right() = new Node();
instead, p->right is assigned the newly allocated object.
|
|
|
|
|
yeap: rule, do not allocate memory to copies.
Still I don't understand what happens internally. In the bellow code ptOut will be a parameter on the internal Stack? How are handled params which come as refs?
Internaly all the params, pointers etc.. have also their own address? Or they are taken like some kind of aliases.
class CTest
{
private:
char *a;
public:
CTest(int n=10)
{
a= new char[10];
a="george";
}
void GetPtrEx2(char* &ptOut)
{
ptOut=a;
}
};
modified 21-Jan-13 13:55pm.
|
|
|
|
|
In the function GetPtrEx2() the address of the parameter will be passed on the stack. So with the assignment you change the address the pointer you called the function with points to.
You should however check your constructor. I don't think it will work as intended.
|
|
|
|
|
I while ago I wrote a Visual C++ program which included 3 calls of the function 'rename(x,y)' (rename file x as y, where x and y are char*), to swop the names of two files . It works.
x=rename(orig,w); y=rename(cor,orig); z=rename(w,cor);
A day or 2 ago I wrote a similar program which calls the same. And all 3 calls of 'rename' do not rename the file but give result -1 = "unknown error". Please what might cause this?
|
|
|
|
|
Right after the failed function use strerror(errno) to get a human readable error message:
#include <stdio.h>
#include <string.h>
#include <errno.h>
....
rename(x, y); printf("Error renaming %s to %s. Reason: %s\n", x, y, strerror(errno));
....
}
|
|
|
|
|
I did use strerror(errno), and it said "unknown error".
|
|
|
|
|
Check the values of all your file names when you call the function. Also what is the actual value of errno when the call returns?
|
|
|
|
|
> Also what is the actual value of errno when the call returns?
It is -1.
|
|
|
|
|
OK, you need to show a bit more of your code and the actual values of the old and new filenames that you are trying to rename.
|
|
|
|