Hi Mates, Can u please tell me whats happpenning in those. Please tell what ever u got. Outline the functinaliy in normal words. i am new to C++. I need to write SWIG wrapper which checks this C++ Code in perl.
Please tell , what ever u understood .
Thanks in advance -
#include <iostream>
-
#include "stdafx.h"
-
#include "client.h"
-
using namespace std;
-
-
int main(int argc, char* argv[])
-
{
-
char szKey[48];
-
Key k;
-
Block *b;
-
int total;
-
TransferResult ret;
-
//printf("%d", argc);
-
if ((argc == 8) || (argc == 9))
-
{
-
str_to_key(argv[2], k);
-
if (strcmp(argv[1],"-put") == 0)
-
{
-
total = HEADER_SIZE(Block) + atoi(argv[3]);
-
b = (Block *) MALLOC(void, total);
-
b->size = atoi(argv[3]);
-
memcpy(b->data, argv[4], b->size);
-
}
-
}
-
else
-
{
-
cout << "Usage:" << endl;
-
cout << " FakeFEClient.exe -p <key> <value>" << endl;
-
cout << " FakeFEClient.exe -g <key>" << endl;
-
return 0;
-
}
-
-
-
try {
-
-
Client *c;
-
-
if (strcmp(argv[1],"-get") == 0)
-
c = new Client(argv[5], atoi(argv[7]));
-
else
-
c = new Client(argv[6], atoi(argv[8]));
-
-
-
key_to_str(k, szKey, sizeof(szKey));
-
-
-
if (strcmp(argv[1],"-put") == 0)
-
{
-
ret = c->PutBlock(k, b,10000);
-
if (ret == TR_Processed)
-
{
-
cout << "Put operation successful";
-
}
-
else
-
{
-
cout << "Put operation failed";
-
}
-
free(b);
-
}
-
-
if (strcmp(argv[1],"-get") == 0)
-
{
-
byte block_buf[BLOCK_BUF_LIMIT];
-
Block* block = (Block*)block_buf;
-
block->size = atoi(argv[3]);
-
ret = c->GetBlock(k, block, 1000);
-
if (ret != TR_Processed)
-
{
-
cout << "Get operation failed";
-
return 1;
-
}
-
block->data[block->size]='\0';
-
printf("%s",block->data);
-
}
-
-
-
}
-
catch (NetworkException e)
-
{
-
std::cout << "Network exception raised" << std::endl;
-
}
-
catch (...)
-
{
-
std::cout << "Exception raised" << std::endl;
-
}
-
-
return 0;
-
}
-
-
1 1376
The person who wrote this is also new to C++ because the code is largely C.
I would suggest you locate the author and ask what the code does.
I could help if you had a specific question but not when what you ask is really not a question at all but is a request for a consultation.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Xavier Noria |
last post by:
A Google search here for folding Python code in Emacs pointed to
outline.el, but when I try to use some *-hide-* commands I get "Wrong
type argument: stringp, nil". The header of the file has no...
|
by: Agent Mulder |
last post by:
I feel the need for an outline specifier to
facilitate java-style programming.
|
by: Chris Bradbury |
last post by:
Hi,
I'm posting in this forum for the first time so if I break any conventions
or protocols I'm sorry.
I've attached this style:
*:focus { outline: none }
to a page but it doesn't remove...
|
by: Felix Collins |
last post by:
Hi,
I'm not a regexp expert and had a bit of trouble with the following
search.
I have an "outline number" system like
1
1.2
1.2.3
1.3
|
by: John |
last post by:
I have a function declaration that gives an error while compiling.
Can anyone help me figure this one out?
inline void create(const std::vector< myclass >& plist,
std::vector< myclass...
|
by: NotYetaNurd |
last post by:
please try the following
float F1=1.0f;
float F2=1.0f;
string testString = " "+ ((F1-F2)>0)?"test1":"test2"; //throws error while
compilation
and
|
by: John Doe |
last post by:
I collapse an outline block, then copy it, then paste it. In my experience,
the outline block always expands after the paste. Is their a way to modify
the editor's behavior so that an outline block...
|
by: deko |
last post by:
I.
A.
B.
II.
A.
1)
2)
B.
C.
|
by: mattehz |
last post by:
Hey there,
I am trying to upload old source files and came across these errors:
Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_html.php on line 59...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |