|
I made some modifications and works fine. Thanks for the support
|
|
|
|
|
The math is working: 4/4=1.
The problem looks like dVertexes is not a true array. It is an atomic type (double ) or a pointer.
Note that using sizeof(...) in this way does not work correctly with pointers to arrays, even if they are pointers that have decayed from a true array.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
ok, so how can I discover the array size? I don't want to use vectors....
|
|
|
|
|
You have to pass the size to the called function to let it know how much valid data exists.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I've made this:
primitive.Shape(GL_TRIANGLES, fVertexes, sizeof(fVertexes), 0,1,1);
And in the function I'm divided the size of array by the size of first element in the array. Works fine, thanks for help
|
|
|
|
|
Depending on how often you are passing these arrays around and how frequently the size changes, you might want to declare a struct with the array and the size as members, then pass that to your functions.
typdef struct _double_array
{
double array[9];
int nCount;
} DOUBLE_ARRAY, *LPDOUBLE_ARRAY;
You can then pass the stuct 'DOUBLE_ARRAY' or a pointer to the struct 'LPDOUBLE_ARRAY' .
|
|
|
|
|
Thanks for the tip. It's a good idea
|
|
|
|
|
No problem. If you look into the windows api's, you will find that many of the functions are declared like this, you either have to set up a struct or you get one back. My current project calls on the need of dealing with several arrays all relating to the same info, so instead of passing all the arrays and sizes to each function, I simply pass a pointer to a struct.
|
|
|
|
|
If the array is allocated on the heap, sizeof behaves differently than it does if it was on the stack.
int i = 0;
float stackArray[5];
i = sizeof(stackArray) / sizeof(stackArray[0]);
float* heapArray = new float[5];
i = sizeof(heapArray) / sizeof(heapArray[0]);
int myFunction(float* myArray)
{
return sizeof(myArray) / sizeof(myArray[0]);
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I have an MDI application.
In these , i have a model-less dialog box with a button which when clicked opens up a child window in the background of the dialog box
How can i make the child window to appear foreground and dialog box to appear
background when the button is clicked
|
|
|
|
|
Hi,
Could you be more specific, please? You said that it is an MDI application, though is your dialog-box created as standalone window, or as MDI-Child? If your second dialog-box is created as MDI child inside MDI frame, it can't be displayed in foreground.
Regards
|
|
|
|
|
I have a dialog box on start-up of the application .
when a button is clicked on the dailog box , it pops up an MDI child window which is displayed at the background.
|
|
|
|
|
Hi,
Veeresh Hiremath wrote: pops up an MDI child window
and this is why it is displayed in the background. As long as you create it as MDI child it is supposed to be displayed below your dialog box, though in the foreground of the parent MDI frame. This is exactly how MDI works.
Also, "it pops up" is not really the case here, since MDI child windows aren't popped up, these are just MDI frame's child windows, and if you want window to be popped up, you have to obey MDI and create it as popup.
Regards
|
|
|
|
|
Thanks for the information.
|
|
|
|
|
I want to know the path of favourites of user who is logged in of system?
|
|
|
|
|
Hi
SHGetSpecialFolderLocation with CSIDL_FAVORITES
-----------
Mila
|
|
|
|
|
of course should be SHGetSpecialFolderPath and not SHGetSpecialFolderLocation
-----------
Mila
|
|
|
|
|
char szPath[255];
if(SUCCEEDED(SHGetSpecialFolderPath(NULL,szPath,CSIDL_FAVORITES, 0)))
{
MessageBox(szPath);
}
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
Hi Everybody,
I'd like to know how to get the windows installed drive?
If I installed Windows in C: drive, the result should be "C:".
Is there any API available to get this?
Thanks in advance,
Sarvan AL
*** Live Lift To Its Fullest ***
|
|
|
|
|
Use
GetWindowsDirectory()<br />
<pre> char cBuf[255];
GetWindowsDirectory(cBuf,255);
MessageBox(cBuf); </pre> <br />
This will give you the path to windows directory however. <br />
<br />
<div class="ForumSig"><font face="Verdana" color="Crimson" size="1.4">Nobody can give you wiser advice than yourself. - Cicero</font></div>
|
|
|
|
|
|
How to get the System Name & IP Address in Linux using C.
I m using gcc compiler.
I tried it using code for getting System Name & IP in Window , but output I am getting is "localhost.localdomain" & "127.0.0.1" (but system has IP).
Also how to get/check the System Name in Linux Environment?
Plz. help me.
Sorry I didn't found the exact Community for my que.
|
|
|
|
|
Hi,
You have to include following headers: <netdb.h> <arpa/inet.h>
By using gethostbyname(name) you will get hostent structure filled with available information about host under the name specified as parameter.
By using gethostbyaddr(addr, len, type) you will get hostent structure filled with available information about host under specified IP address.
In order to get system name, you can use h_name member of hostent structure.
To get IP address/es, you can use h_addr_list member of hostent structure to list all associated addresses or use h_addr pointer to first available address.
Example:
struct hostent *lphe;
lphe = gethostbyname("mylinux");
if (!lphe) {
} else {
printf("Computer name is : %s\nIts IP address is: %s", lphe->h_name, inet_ntoa(lphe->h_addr));
}
Hope that helps a bit...
Regards
|
|
|
|
|
Galatei wrote: lphe = gethostbyname("mylinux");
How / From where I can get this name ("mylinux")?
Galatei wrote: inet_ntoa(lphe->h_addr)
It is giving error that Can't convert to char* from in_addr.
|
|
|
|
|
Aniket Salunkhe wrote: How / From where I can get this name ("mylinux")?
#include <unistd.h>
#include <limits.h>
char name[HOST_NAME_MAX+1];
int result;
result=gethostname(name, HOST_NAME_MAX+1);
|
|
|
|