|
If your only problem would be an array with one dynamic dimension, you could try this:
std::vector<double> array[500][25][10];
That will create an array of 125000 double vectors of dynamic size. The statical allocation will not be a problem, and the time required for the dynamic allocation will be proportional to the actual number of elements. The only performance problem will be the deallocation - whenever that array runs out of scope, your program will take a considerable amount of time. With 125000 arrays, expect the deallocation to run for anything between a couple of seconds and a few minutes!
However:jothivel k wrote: (i) I am storing 4th dimenstion size is more than vector[0][0][0].max_size()
If I understand this comment correctly, you are trying to statically store data that exceed the address space of your application! If so, the answer is simple: you can't do that! What you need is a database! Try your luck with MySQL or google for another database library.
|
|
|
|
|
You could consider simply making the final index fixed at N.
Alternatively, don't even bother. The index is a fairly simple calculation, so simply allocate an array of the proper size and do the calculation yourself.
|
|
|
|
|
Dear sir,
I have given a doc of logon request which should be formatted like given below -
00 2E 60 01 23 06 00 08 00 20 20 01 00 00 c0 00 .5 .#.... .....
00 92 00 00 00 00 12 01 23 48 30 30 30 30 30 30 ........#H000009
39 53 31 30 30 30 30 30 30 30 30 30 30 30 30 35 9S10000000000005
when i extracted bit fields from bit map i got the fields 3,11,24,41,42 in which field 3 and 11 are in N6 format, field 24 is in N3 format and field 41,42 are in ANS format..
I have gone through many reference sites of iso 8583 message format but i did not how can send the data..
whether i should convert the fields which are in N6 to BCD.
whether i will have to send bit field as it is or i need to change it also in BCD..
How to send..pls help
|
|
|
|
|
There is only one reference page which is reliable when it is about ISO, and this is ISO.org.
Have a look at the standard as it is scripted there[^] and you will find the answer by yourself.
|
|
|
|
|
I have sent the packet through tcp socket. when i was analyzing the packet through wireshark i was getting the packet in the server side like below :
2E 60 01 23 06 08 20 20 01 c0 00 .5 .#.... .....
92 12 01 23 48 30 30 30 30 30 30 ...#H000009
39 53 31 30 30 30 30 30 30 30 30
30 30 30 30 35 9S10000000000005
while my actual packet is
00 2E 60 01 23 06 00 08 00 20 20 01 00 00 c0 00 .5 .#.... .....
00 92 00 00 00 00 12 01 23 48 30 30 30 30 30 30 ........#H000009
39 53 31 30 30 30 30 30 30 30 30 30 30 30 30 35 9S10000000000005
Why all 00 bytes are not getting sent..Can anybody tell me.
Please Help !!!!!
|
|
|
|
|
Once again, read the ISO standard carefully, it is explained nicely there.
And you might want to learn about sockets, or post the problem with the socket separately.
|
|
|
|
|
Message Closed
modified 25-Apr-13 3:33am.
|
|
|
|
|
Pleas edit this entry and remove the blockquote surrounding the code and replace with <pre> tags, so your code is readable.
Use the best guess
|
|
|
|
|
|
1. I guess you did not understand what "please edit the above entry" means.
2. Check what?
Use the best guess
|
|
|
|
|
Hello Sir,
I really did not understand what "please edit the above entry" means. Can you pls tell me..
Do I need to edit something in the code or is this not the write way to post the code?
Thanks
|
|
|
|
|
He kindly asked you to edit your existing post (there is a button to do so) and format the source code so that it is readable. To do so, select the code section and click the 'code' button above the editor window or place a <pre> tag at the begin of the code and a </pre> at the end (when clicking the 'code' button this is done automatically). In all cases, check the preview window below the editor window.
In the editor window it should look like this:
<pre lang="c++">
// A comment
#include <stdio.h>
int main()
{
return 0;
}</pre>
Then the preview (and the final post) will look like this:
#include <stdio.h>
int main()
{
return 0;
}
|
|
|
|
|
I am using the below code for packing the data in iso 8583 format
00 2E 60 01 23 06 00 08 00 20 20 01 00 00 c0 00
00 92 00 00 00 00 12 01 23 48 30 30 30 30 30 30
39 53 31 30 30 30 30 30 30 30 30 30 30 30 30 35
#include <WS2tcpip.h>
#include <stdio.h>
#include <stdlib.h>
#include <WinSock.h>
#include <wchar.h>
#include <string.h>
char cHexDigit_to_Nibble1(unsigned char c)
{
if(!isxdigit(c))
return (0);
if(isdigit(c))
return (c - '0');
c = toupper(c);
return (c - 55);
}
void vAscii2BCD(unsigned char *pucSrc, unsigned char *pucDst, int inSize)
{
for (; inSize > 0; inSize -= 2, pucDst++)
{
if(!memcmp(pucSrc, "3D", 2))
{
pucSrc += 2;
*pucDst = '=';
}
else
{
*pucDst = cHexDigit_to_Nibble1(*pucSrc++) << 4;
*pucDst |= cHexDigit_to_Nibble1(*pucSrc++);
}
}
printf("data is %s\n\n",pucDst);
}
int main()
{
int sock_desc, status;
struct sockaddr_in client;
struct addrinfo hints;
WSADATA Data;
int bytesSent;
int bytesRecv = SOCKET_ERROR;
unsigned char *pucSrc = (unsigned char*) malloc (100) ;
unsigned char *pucDst = (unsigned char*) malloc (256) ;
memset(pucSrc,0,256);
memset(pucDst,0,256);
vAscii2BCD((unsigned char*)"00" ,pucDst, 1) ;strcpy((char*)pucSrc,(char*)pucDst) ;
memset(pucDst,0,256);
vAscii2BCD((unsigned char*)"2E" ,pucDst, 1) ;strcat((char*)pucSrc,(char*)pucDst) ;
memset(pucDst,0,256);
vAscii2BCD((unsigned char*)"6001230600" ,pucDst, 5) ;strcat((char*)pucSrc,(char*)pucDst) ;
memset(pucDst,0,256);
vAscii2BCD((unsigned char*)"0800" ,pucDst, 2) ;strcat((char*)pucSrc,(char*)pucDst);
memset(pucDst,0,256);
vAscii2BCD((unsigned char*)"2020010000" ,pucDst, 5) ;
strcat((char*)pucSrc,(char*)pucDst);
memset(pucDst,0,256);
vAscii2BCD((unsigned char*)"C00000" ,pucDst, 3) ;
strcat((char*)pucSrc,(char*)pucDst);
memset(pucDst,0,256);
vAscii2BCD((unsigned char*)"920000" ,pucDst, 3) ;
strcat((char*)pucSrc,(char*)pucDst);
printf("size of pucSrc = %d\n", strlen((char*)pucSrc));
vAscii2BCD((unsigned char*) "0000" ,pucDst, 2) ;
strcat((char*)pucSrc,(char*)pucDst) ;
printf("size of pucSrc = %d\n", strlen((char*)pucSrc));
memset(pucDst,0,256);
vAscii2BCD((unsigned char*) "12" ,pucDst, 1) ;strcat((char*)pucSrc,(char*)pucDst) ;
memset(pucDst,0,256);
vAscii2BCD((unsigned char*)"0123" ,pucDst, 3) ;strcat((char*)pucSrc,(char*)pucDst) ;
strcat((char*)pucSrc,"H0000009S10000000000005");
printf("size of pucSrc = %d\n", strlen((char*)pucSrc));
status = WSAStartup(MAKEWORD(2, 2), &Data);
if(status != 0)
{
printf("ERROR: WSAStartup unsuccessful");
return 0;
}
else
{
printf("WSAStartup Successfull\n");
}
sock_desc = socket(AF_INET,SOCK_STREAM,0);
if ( sock_desc == INVALID_SOCKET ) {
printf( "Error at socket(): %ld\n", WSAGetLastError() );
WSACleanup();
return;
}
client.sin_family = AF_INET;
client.sin_addr.s_addr = inet_addr( "41.208.68.76" );
client.sin_port = htons( 4444 );
if(connect(sock_desc,(struct sockaddr*)&client,sizeof(client)) == SOCKET_ERROR) {
printf( "Failed to connect.\n" );
WSACleanup();
return;
} else{
printf("connect successfull\n");
}
bytesSent = send( sock_desc, pucSrc, strlen(pucSrc), 0 );
printf( "Bytes Sent: %ld\n", bytesSent );
while( bytesRecv == SOCKET_ERROR ) {
bytesRecv = recv( sock_desc, recvbuf, 256, 0 );
if ( bytesRecv == 0 || bytesRecv == WSAECONNRESET ) {
printf( "Connection Closed.\n");
break;
}
printf( "Bytes Recv: %ld\n", bytesRecv );
if (bytesRecv < 0)
return;
printf( "Bytes Recv: %ld\n", bytesRecv );
}
return 0;
}
when I was analyzing the packet through wireshark I was getting the packet in the server side like below :
2E 60 01 23 06 08 20 20 01 c0 00
92 12 01 23 48 30 30 30 30 30 30
39 53 31 30 30 30 30 30 30 30 30
30 30 30 30 35
Why all 00 bytes are not getting sent.
|
|
|
|
|
You are using string functions (strcpy() etc.) to copy your data (which are not strings) from one buffer to another, so each copy will stop as soon as it hits a zero character. Use memcpy() and ensure you copy the exact number of bytes that you wish to transfer.
Use the best guess
|
|
|
|
|
Hi All,
I have made an MCI player which plays ".wav" file well using MCISendString command.
Now I want my application to get number of headsets (audio output)devices attached. I want to play my wave file simultaneously in all the audio output devices.
Please help!
Thanks in advance
|
|
|
|
|
|
Hi i have developed an tool which writes data into the MS-Access file (Eg: empdata.mdb which exist in remote pc).
- Certainly this exe will run in many machine across network( Approxmatively 30 machines)
When i run the exe in diffrent machines (windows 7) it giving
the following error.
"It is already opened exclusively by another user , or u need permission to view its data."
Could anyone help in resolving the issues.
Thanks & Regards
Mani
|
|
|
|
|
The error message indicates that the database has been opened by another application with exclusive access or the user hasn't sufficient privileges to access the database file.
When using the CDaoDatabase class, pass FALSE as second parameter to the Open() function.
When using Access, it must be configured to open files in shared mode (this is the default).
The database file must be readable and writable for the users.
See also Ways to share an Access database[^].
|
|
|
|
|
Hi,
Is it 'thread safe' to use API'slike
::SetWinowText(...) and
::ShowWindow(hWnd,nCmdShow) across threads, or should I use e.g.
::SendMessage(hWnd,WM_SHOWWINDOW,fShow,bShow) I want to Hide and Show and set aspects of a Progress Dialog box during the run of the worker thread.
Regards,
Bram van Kampen
|
|
|
|
|
It is always recommended to use SendMessage to the UI thread so that the UI thread controls/manipulates its UI elements.
In some cases it may not be necessary like, for example, the documentation for SetWindowText says that a WM_SETTEXT message is send by the API.
|
|
|
|
|
«_Superman_» wrote: It is always recommended to use SendMessage to the UI thread... But what about deadlock?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
SendMessage is the right way to avoid deadlocks.
This way all requests from any thread is always queued in the UI thread message loop.
So keeping all locks local to the message handlers will help in avoiding deadlocks.
|
|
|
|
|
«_Superman_» wrote: SendMessage is the right way to avoid deadlocks. This article would tend to disagree.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
hi,
i have to implement one method to get all domain names from adsi forest in c++ anyone tell that how can do that in c++.
thanks
|
|
|
|
|
I think my past sins and assumptions are coming home to haunt me. I have a fairly large/complex application that began its past life in another product. Consider it a dialog application with a lot of dialogs. The dialogs can become 3 or more deep. On rare and random occasions, the application will crash with a stack overflow exception - only when leaving a dialog. The exception happens somewhere after EndDialog processes.
Yes, I have checked stack usage - I'm well under the specified amount. The problem is very rare. My debug efforts have led me to the path of suspecting some sort of race condition in message processing or some other undetected data corruption.
The application itself uses your standard windows messages. However, I have a number of worker threads that post messages into the application message queues. My approach is what I need a basic sanity check on
In the InitInstance, I create a worker thread using ::CreateThread() - system timer, whose sole responsibility is to notify active dialogs that a time event has occurred. This thread:
- acquires a pointer to CWnd via AfxGetApp().
- posts the message to the window using PosteMessage()
- there is no stack allocated data passed of any kind whatsoever in these messages.
Based on what I have read about this approach, it's legal and the only appropriate way for a worker thread to send data to the GUI thread. Opinions?
My next question has to do with what I consider to be a possible race condition. Given that my worker thread is firing off messages irrespective of what is going on elsewhere in the application, is it possible for the worker thread to send a message to a window AND have the user press the "Exit" button before the message arrives? If so, I would expect the dialog to be in some sort of tear down state such that some of it's processing is indeterminate. Is my concern reasonable?
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|