|
I want to load an array and print the array using pointer. But I can't do it with the program below whose output is also provided...
#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2],i,j,m,n,**p;
clrscr();
printf("\nEnter the order:");
scanf("%d%d",&m,&n);
printf("\nEnter the elements:\n");
for(i=0;i
|
|
|
|
|
Please, use the 'code block' button to surround your code snippet with <pre> tags, since, as you may see, your code, as it stands, is unreadable.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi apart from that I can not read your code either, I would guess you are going on past end over your array ( see the output of the strange numbers) .
So either fix your post, or you try to find the line where you ran over the border.
Cheers
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
|
|
|
|
|
Gjm wrote: I want to load an array and print the array using pointer.
Are you wanting something like this:
void main( void )
{
int a[2][2],i,j,m,n,*p;
printf("\nEnter the order:");
scanf("%d%d", &m, &n);
printf("\nEnter the elements:\n");
for (i = 0; i < m; i++)
{
for (j = 0; j < n; j++)
{
scanf("%d", &a[i][j]);
}
}
p = a[0];
printf("\n\nThe elements are:\n");
for (i = 0; i < m; i++)
{
printf("%d\n", *(p + i));
}
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
can you explain ur problem in more detail,
like how u are opening one port etc..
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
|
did u try to call openport two times with two different ids?
modified on Monday, June 22, 2009 7:20 AM
|
|
|
|
|
|
jitendrapothuru wrote: hCommn = NULL;
Of course, if you only have one single handler for all your COM ports, this is not going to work. You have to use one handler for each of the COM port you want to open...
|
|
|
|
|
|
jitendrapothuru wrote: so should i have multiple handlers for multiple comports to be opened then....
hCommn= NULL is jus only initialisation na...
Is there something missing in your sentence, because I don't understand it at all ??
Anyway, are you using mutliple instances of your class or only one instance ? If you are using multiple instances of the class then it's fine but if you are using only one instance, you will "share" the handle for all COM ports, which won't work.
Later on, how are you accessing the COM port ? Please post some useful code...
|
|
|
|
|
|
So, for my other question: how many instances of the class did you create ? Show the code where you create the class.
And please use the pre tags when posting code snippets because it is almost impossible to read now...
|
|
|
|
|
|
Which class are we talking about from the start of this discussion ?
CCommnCtrl of course, the one where all your code to access your COM port is...
|
|
|
|
|
|
jitendrapothuru wrote: this is the class to open the port and i have created only one instance of the class
So, you have multiple ports but you only create one instance of the class, which means you only have one single COM handle. So, you'll only be able to access the last opened port.
If you want to manipulate multiple COM ports, you have to create one instance of the class for each COM port you want to access and use all of these instances to access the different ports (one instance of the class relates to one single COM port).
|
|
|
|
|
|
Sorry, I don't understand your question
|
|
|
|
|
|
jitendrapothuru wrote: COMMN_CTRL_CLASS *poCommunication = new COMMN_CTRL_CLASS;
Use an array, instead of a single element. Each element in the array relates to one COM port. But it is perhaps even better to use a dynamic array (take a look for instance at std::vector or std::list). Anyway, how are you accessing one particular port later on ? How do you know that you have to read data from the first port for instance ?
|
|
|
|
|
My application will take the parameters like comport name, baud rate, stopbits from the commnsettings dialog box in the application first and then it will try to open those ports. so settings dialog box will take the settings from the user and send it to my main application and then that port will be opened. so i tried to implement using an array to take the values of multiple comports first which i failed using the for loop which is going into an endless loop since its getting intialised everytime i press ok button in settings dialog box.
|
|
|
|
|
By the way, why did you delete your previous messages ? Now, nobody can't help you amymore...
|
|
|
|
|
Hi,
Using MFC application, i need to input an xml schema to an MFC exe and i need to generate xml file as an output from the specified schema. I need to do this only in MFC application.
Please suggest me some resolution as how to generate xml from schema using MFC application?
Regards,
Hema K
|
|
|
|