|
subburamKR wrote: Is it possible to Pass a 2dimension array to a function without specifying number of elements
Of course: you can pass the address of that array. The question is what can do the function with an array of unknown sizes?
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.
|
|
|
|
|
if it is a C matrix, then no, the function has no other way to know the number of elements but by getting it as a parameter. wonder what can happen if the function read/writes outside the actual bounds of the array ?
but you can construct a matrix class, or a std::vector<std::vector<type>>
|
|
|
|
|
The easiest way is to pass a vector of vectors, it will know it's size.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Anythings possible.
I suggest 2 ways:
First, how about putting the size in the first element? Cheating I know.
Second, put a terminator value in the last element which is used, similar to the \0 terminator in a string in C. But then you have to know some value which will never be used in the array. For example, if the 2-D array is 16-bit signed integers representing ground altitude in feet, use 32767 since Everset is ?? 29000 feet.
|
|
|
|
|
Hi,
I want to seperate some flash player functionalities as a seperate dll,so I want to make loadmovie function in that,
void Loadmovie(const char* url,bool IsMBCS)
url->Path of the movie
IsMBCS->to check coding(multibyte or unicode)
it in turn calls many functions,
Now i have to write c++ function to load a movie specified in the load movie function,what can i do???
Siddharth
|
|
|
|
|
Dear friends,
i have added Dialogue box on a tab control using
m_tab1dlg1->Create(IDD_LINEPROGRESSVIEW_FORM,&m_tabDetails);
but with this same i m not able to attach Form view..
Can anybody help me....
Megha
|
|
|
|
|
A CFormView is a CView which lives within the realm of a CFrameWnd , not a tab control.
/ravi
|
|
|
|
|
Hi all,
I am making one win32 client-server application using VC++.NET 2003. I am using NetworkStream->Write() function to send data. Now I am new in C++ programming and I want to send some BYTE values using this function but I don’t know how can I make array of all BYTEs I have. I know I can make array of BYTE from string using Encoding::ASCII->GetBytes() function but I have raw BYTE data like 0x09, 0x31, 0x21 etc..
Thanks in advance,
Priyank
|
|
|
|
|
For instance
BYTE myByteArray[]={0x09, 0x31, 0x21};
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.
|
|
|
|
|
Thanks,
It works for
BYTE myByteArray[]={{0x09}, {0x31}, {0x21}};
but I want to use the same variable for many time. How can I enter new values after sometime?
|
|
|
|
|
|
No idea. But I wouldn't take it too seriously. The votes that other people gives you does not affect your status and IMHO is only used to reflect people's feelings about the topic.
Nice, if you get top votes, but no skin off your back if you don't.
I Dream of Absolute Zero
|
|
|
|
|
Yeah, I should try to ignore it though it irritates a bit. It just says playful kids are around! Funny
286? WOWW!
|
|
|
|
|
I would guess it was because you didn't bother to look at the documentation before making your reply that questioned the relevance of a correct statement.
|
|
|
|
|
Anyone can vote as they please; they are free to vote you down for no other reason then that it amuses them to do so. I don't see what Chris can (or will be willing) to do about it; he's not about to turn the CodeProject into a dictatorship!
Steve
|
|
|
|
|
I'm using the win32 API, so I would like to be able to use the SendMessage Function to change the text in these two controls.
eg:
SendMessage(GetDlgItem(hDlg,IDC_TIMESLIDER),UDM_GETPOS,0,0);
*this code is for getting the position from a slider*
Anyone know where I can find the flag for changing text, or for that matter some decent documentation on this?
|
|
|
|
|
For instance see [^]
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.
|
|
|
|
|
|
hi!
i compiled the following code...
some error is being shown in _endthreadex and _beginthread
mpr.lib and wsock32.lib is included but still not working...
pls tell me if any other changes has to be made...
// HEADER FILE
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include<stdlib.h>
#include<stddef.h>
char buffer[]="ANY DATA"; // Static Global Data
/*-------------------------------------------------------------------*/
void MyFunction( void* Arg )
{
SOCKET Client=(*(int *)Arg);
while(1)
{
send(Client,buffer,100,0);
}
_endthreadex(0);
}
/*--------------------------------------------------------------------*/
void main(void)
{
int a,b,c,d; // For Server Address or Address of P1.
int port; // For Port No of Server or Port of P1.
struct sockaddr_in serv_addr,cli_addr;
SOCKET Server;
SOCKET Client;
int clilen=sizeof(cli_addr);
/***************************************************/
/* SOCKET INITIALISATION */
/***************************************************/
WSADATA WsaDat;
if (WSAStartup(MAKEWORD(1,1),&WsaDat) != 0)
{
printf("\n\n WSA Initialization failed! STOP!!!");
exit(1);
}
/***************************************************/
/* SOCKET CREATION */
/***************************************************/
Server = socket(AF_INET, SOCK_STREAM, 0);
if (Server == INVALID_SOCKET)
{
printf("\n\n Socket creation failed!STOP!!!");
exit(1);
}
else
printf("\n\n SOCKET IS CREATED SUCCESSFULLY...");
/***************************************************/
/* SERVER ADDRESS */
/***************************************************/
serv_addr.sin_family=AF_INET;
printf("\n\n ENTER THE SERVER IP ");
scanf("%d%d%d%d",&a,&b,&c,&d);
serv_addr.sin_addr.S_un.S_un_b.s_b1 =a ;
serv_addr.sin_addr.S_un.S_un_b.s_b2 =b ;
serv_addr.sin_addr.S_un.S_un_b.s_b3 =c ;
serv_addr.sin_addr.S_un.S_un_b.s_b4 =d ;
printf("\n\n ENTER THE PORT NO ");
scanf("%d",&port);
serv_addr.sin_port = htons(port);
/***************************************************/
/* BIND THE SOCKET*/
/***************************************************/
if (bind(Server,(struct sockaddr *)(&serv_addr),sizeof(serv_addr)) == SOCKET_ERROR)
{
printf("\n\n Attempt to bind failed!STOP!!!");
}
else
printf("\n\n BIND PROCESS IS CREATED SUCCESSFULLY...\n ");
/***************************************************/
/* LISTEN FOR RECEIVING CONNECTION*/
/***************************************************/
if(listen(Server,5)==SOCKET_ERROR)
printf("\n Error in Listenning The Socket!STOP!!!");
/*---------------------------------------------------*/
while(1)
{
printf("\n SERVER IS RUNNING ...");
Client=accept(Server,(struct sockaddr*)&cli_addr,&clilen);
_beginthread(MyFunction,0,(void *)&Client);
}
getch();
}
tell me the solution to remove the error:
unresolved symbol_@winmain16
pls do reply me as soon as possible..
|
|
|
|
|
Hi,
WSAStartup
Have you linked the following lib file to your project:
Library Use -> Ws2_32.lib : Link WSAStartup[^]
_beginthread
Have you included the following header file to your project:
#include <process.h> /* _beginthread, _endthread */
Link _beginthread[^]
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
thanks a lot for ur earliest reply..
i will try out with ur information sir....
thanks again...
|
|
|
|
|
Hi all,
I have created a tab control with 4 tab items.2 tab items are disabled initially.Only the enabled tab items must be focussed when the mouse pointer is placed onto the corresponding enabled tab item.
problem i am facing here is even the disabled tab items are focussed when the mouse pointer is moved onto the corresponding disabled tab item
pls suggest me how to avoid getting focus on the disabled tab item
Thanks,
Sireesha
|
|
|
|
|
You could try catching the GetFocus event and setting the focus back to the previously-focused tab.
Phil
The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.
|
|
|
|
|
I seen many examples about ListBox,in DrawItem they use the state and the action to decide how the item should be drawn. I am puzzled that what is difference between focus and the select or selected.Besides,is the whole ListBox redrawn when I click the item when the program are running?Could somebody give details~?
Thanks~
|
|
|
|
|
In many controls (like a standard listbox) the focus state and selected state are set at the
same time.
Having both states gives custom controls a way to indicate keyboard focus without an item being selected or vice-versa.
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|