|
I knew that we can not create multi dimensional array with new. But in Navigating C++ and Object-Oriented Design book, it writes:
Type *pname = new Type[size]; <br />
Type (*pname)[size2][sizeN] = new Type[size1][size2][sizeN];
for example:
A (*pu)[1] = new A[1][1];
delete [] pu;
Is this example code really means that this is dynamic array? Or something different?
Assume that we create N-size array, Is it always enough to write delete[]?
Thanks.
|
|
|
|
|
Hi.
With Visual Studio 2005 and .NET it's too easy to consume and create a Web Service, but what about using MFC?. I got a MFC application, (a dialog based application), and I need to consume a Web Service, (created with Visual Studio 2005 in ASP.NET), how could I do that?. I know, SOAP is the answer, but I need a guide, (maybe there's an article already writen, or something like that).
Thank you and regards.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
|
Yes Mike!
That's what I need!!. Right on target!.
Thank you.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
hey everyone. can anyone help me with setting up a texture in visual studio.
heres my code just in case thats the reason why my texture isnt showing up.
thanks everyone!!!
#include <gl glut.h="">
#include <gl glu.h="">
#include <gl glaux.h="">
#include <stdio.h>
GLuint texture;
int width, height;
BYTE * data;
FILE * file;
void changeSize(int w, int h)
{
if(h==0)
h = 1;
float ratio = 1.0*w/h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, w, h);
gluPerspective(45, ratio, 1, 1000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0.0, 0.0, 5.0,
0.0, 0.0, -1.0,
0.0f, 1.0f, 0.0f);
}
void renderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(GL_TEXTURE_2D, texture);
glBegin(GL_QUADS);
glTexCoord2d(0.0, 0.0); glVertex3f(-1.0f, -1.0f, 0.0f);
glTexCoord2d(-1.0, 1.0); glVertex3f(-1.0f, 1.0f, 0.0f);
glTexCoord2d( 1.0, 1.0); glVertex3f( 1.0f, 1.0f, 0.0f);
glTexCoord2d( 1.0, -1.0); glVertex3f( 1.0f, -1.0f, 0.0f);
glEnd();
glFlush();
glDisable(GL_TEXTURE_2D);
}
GLuint LoadTextureRAW( const char * filename, int wrap )
{
// open texture data
file = fopen( filename, "rb" );
if ( file == NULL ) return 0;
// read texture data
fread( data, width * height * 3, 1, file );
fclose( file );
// allocate a texture name
glGenTextures( 1, &texture );
// select our current texture
glBindTexture( GL_TEXTURE_2D, texture );
// select modulate to mix texture with color for shading
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
// when texture area is small, bilinear filter the closest mipmap
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_NEAREST );
// when texture area is large, bilinear filter the first mipmap
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
// if wrap is true, the texture wraps over at the edges (repeat)
// ... false, the texture ends at the edges (clamp)
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
wrap ? GL_REPEAT : GL_CLAMP );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
wrap ? GL_REPEAT : GL_CLAMP );
// build our texture mipmaps
gluBuild2DMipmaps( GL_TEXTURE_2D, 3, width, height,
GL_RGB, GL_UNSIGNED_BYTE, data );
return texture;
}
void FreeTexture(GLuint texture)
{
glDeleteTextures(1, &texture);
}
void main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH);
glutInitWindowPosition(100, 100);
glutInitWindowSize(320, 320);
glutCreateWindow("Texure");
glutDisplayFunc(renderScene);
glutReshapeFunc(changeSize);
glutMainLoop();
}
as a seal i will never insult the constitution, to kill and not to be killed, to die and not to be....died.
|
|
|
|
|
Dear all
we have a program(binary code) . We want to make it to have high process and thread priority.
is there any function or way that we can do this from an application which we write to make that program have high priority?
Also we have one Device driver which has one kernel mode thread in it.
Is there any way to change the priority of system thread of that driver?
we have only .sys version of that driver.
Regards
Monhi
|
|
|
|
|
Hi,
Does anybody know a tool for Visual Studio .Net, for programming in C++, that when changing a class / data member / function name - it can automatically rename all references to the class / member?
Thanks!
while (i == live) {
have(fun);
}
|
|
|
|
|
google is your friend dude!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hello,
I would like to know HOW I can delete all Cookie from Internet Explorer 7.
Is there a function in the API?? I could not find anything.
Thank you in advance!!
|
|
|
|
|
shareholder771 wrote: I would like to know HOW I can delete all Cookie from Internet Explorer 7.
i don't able to find the specific function, but yes you can delete it from Internet History folder situated!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
You're talking about your intelligence coefficient?
Apart from spam and abuse, we need a "Report crap" link!
|
|
|
|
|
|
It was something like this:
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
so it wasnt a simple question.
|
|
|
|
|
Actually it was two smileys!
I'll let you decide if that's simple or not
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
MarkSalsbery wrote: I'll let you decide if that's simple or not
well said,but it needs to a powerful compiler for decide about it
|
|
|
|
|
brahmma wrote: Apart from spam and abuse, we need a "Report crap" link!
i second you on that!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
BOOL bValue;<br />
<br />
if (bValue)<br />
{<br />
bValue = FALSE;<br />
}<br />
else<br />
{<br />
bValue = TRUE;<br />
}
If write this code to InterLocked functions, how to write?
if (InterlockedExchange(&bValue, TRUE) = TRUE))<br />
{<br />
InterlockedExchange(&bValue, FALSE);<br />
}
Right?
Thanks.
|
|
|
|
|
Currently, i am translating my VC++ 6.0 program into C++ program.
in my old VC++ program, i wrote an struct array into a file using
<br />
for(i = 0; i < struct_array_size; i++)<br />
{<br />
CFile::Write(&struct_address, sizeof(struct))<br />
}<br />
the struct is defined as
<br />
struct S{<br />
string Str;<br />
int Value;<br />
}<br />
Now, i wonder if there is an equivelent in standard C++ for CFile::Write().
Thanks,
|
|
|
|
|
All the same file I/O methods are still there. Are you trying to not use MFC?
The stdio functions (fopen, fread, fwrite, etc.)
The fstream classes
CAtlFile
CFile and derived
Windows APIs
etc.
Also, writing a string object like that - I don't think that will work (it may write but reading
it back in, I don't think so). It will write the object bytes but not the string contents.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery,
thanks,
Yes, I am avoiding to use MFC classes.
Would you please be more detialed on how to use fstream class to implement my purpose.
Yes, i actually had problem with string item in the struct. Actually, I used char Name[20]. However, the length of the contents is varying. 20 is the max. length of the Name attribute of objects. Hence, memory was wasted by objects with a Name less than 20 characters. How to solve this problem.
Actually, I need a function in pure C++ framework to write/read the struct as a whole just as with CFile::Write() in VC.
|
|
|
|
|
cy163@hotmail.com wrote: Would you please be more detialed on how to use fstream class to implement my purpose.
#include <string>
#include <iostream>
using namespace std;
...
class S
{
string Str;
int Value;
public:
friend ostream& operator<< (ostream& os, S& s);
friend istream& operator>> (istream& is, S& s);
};
ostream& operator<< (ostream& os, S& s)
{
os << s.Str;
os.put('\n');
os.write((char *)&s.Value, sizeof(int));
return os;
}
istream& operator>> (istream& is, S& s)
{
is >> s.Str;
is.get();
is.read((char *)&s.Value, sizeof(int));
return is;
}
...
S s;
ofstream myfile("c:\\testmyfile.ext" , ios::binary : ios::trunc);
myfile << s;
...
S s;
ifstream myfile("c:\\testmyfile.ext" , ios::binary);
myfile >> s;
cy163@hotmail.com wrote: Yes, i actually had problem with string item in the struct. Actually, I used char Name[20]. However,
the length of the contents is varying. 20 is the max. length of the Name attribute of objects.
Hence, memory was wasted by objects with a Name less than 20 characters. How to solve this
problem.
I think there's some answers in your other post
cy163@hotmail.com wrote: Actually, I need a function in pure C++ framework to write/read the struct as a whole
Using the fstream classes will give you a OO, C++ way. You can make your class able to serialize
itself, as shown above.
Mark
-- modified at 1:44 Sunday 6th May, 2007
Fixed bonehead code
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Is it possible to have a custom icon size in the system tray?
I would like to be able to overlay a timer (hours:minutes) on top of my system tray icon, but due to the default size (16x16), there simply isn't enough room to display the timer in a visually appealing manner.
Thanks,
Adam
|
|
|
|
|
that would be a cool feature and i've often wanted to do the same.
but i haven’t found a method of doing so
i maybe wrong but i don’t think it is possible to have a icon greater than 16x16 in the sys tray.
|
|
|
|
|