|
Atulmahajan wrote: I can not predict which function is called
Why not?
You have the statement where the decision occurs. There you put the breakpoint.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
only one way.
add break points at the start of all the functions and see
|
|
|
|
|
Is your application multithreaded ?
Regards,
Paresh.
|
|
|
|
|
hi im trying to get the confgui to work in Jxta-C
but when i try to build the project i get a error saying
error C2664: 'jxta_advertisement_get_string' : cannot convert parameter 2 from 'const char [5]' to 'Jxta_index *'
from this line
peername = jxta_advertisement_get_string((Jxta_advertisement*)pa,"Name");
i beleive that jxta_index comes from another file which constructs it as below
struct _jxta_index {
JXTA_OBJECT_HANDLE;
JString *element;
JString *attribute;
char *parm;
Jxta_object *range;
};
can anybody tell me how i should change the jxta_advertisement_get_string line so that it will work
thanks
|
|
|
|
|
pds8475 wrote: can anybody tell me how i should change the jxta_advertisement_get_string line so that it will work
Give it the adress of a Jxta_index as second parameter, instead of the char[5] "Name".
Just like the error-message says.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
hi sorry but im not sure how i would find the address of Jxta_index could you please explain
|
|
|
|
|
To get the address of a variable, you use the so called "address-of"-operator: a <big>&</big> prefixed to the variable name.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
thanks still doest work tho if i use &Name i get a undeclared identifier error if i use &Jxta_index i get a error saying illegal use of this type as an expression
|
|
|
|
|
I have really no idea how jxta works, but the compiler clearly says it doesn't want a string literal here, but the address of a variable of the type Jxta_index .
Whatever that is. And whereever you get that from.
Does the documentation state the call should take a string as the second parameter? Then David Crow could be right:
Exchange "Name" with _T("Name").
Wrapping with _T("") should become a habit with string literals.
This way, in Unicode, the literals are unicode strings, in non-unicode they are char*.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
sorry i have not been able to find any docunentation regarding the jxta_advertisement_get_string method or Jxta_index
|
|
|
|
|
How did you come to code the function call the way you did?
Fact is, the function takes a pointer to a Jxta_index . Not a string.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
|
I don't want to sound harsh but I really think you should learn the C++ basics first. When I look at your replies, it seems that you don't really know what you are talking about.
Your function expects to receive a pointer to a specific structure (Jxta_index) so, why are you passing a string instead ?
You should fill a structure like that and pass its address to the function. And honnestly, I don't think anybody here will be able to help you more than that (because probably not a lot of people here know what jxta is).
pds8475 wrote: if i use &Jxta_index i get a error saying illegal use of this type as an expression
Once again, this is basic C++: Jxta_index is a structure declaration, so as your compiler says you cannot use it as an expression. You need to create an instance of it:
Jxta_index myStruct;
Then fill it appropriately (should be documented somewhere I suppose) and then pass its address to your function.
|
|
|
|
|
just to make it clear i didnt write this a developer at sun did
|
|
|
|
|
Yes, I know that you didn't write these functions. But honnestly this is really basic C++: this is just a function that accepts a pointer to a structure as parameter. How to use it should be explained somwhere in a documentation.
|
|
|
|
|
hi there is very little documentation on Jxta-c and after searching the net i can only find 3 references to Jxta_index and they are talking about other classes that use Jxta_index
|
|
|
|
|
pds8475 wrote: there is very little documentation on Jxta-c
There is a complete API-Doc[^] (automagically made from the code by doxygen). It is properly linked at the Projects website.
I must admit that the documentation seems to be wrong for jxta_advertisement_get_string() . The brief description and the "Parameters" section seem to contradict.
Probably the Parameters-comment has not been updated - thebane of doxygen-like documentation.
char* jxta_advertisement_get_string ( Jxta_advertisement * ad,
Jxta_index * ji
)
Many fields of an advertisement struct can be represented as a character string, which may be obtained by this function.
Parameters:
Jxta_advertisement * ad
char * key for advertisement field desired
Returns:
char * representation of value corresponding to key.
Warning:
Returns a copy that must be freed.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
|
pds8475 wrote: error C2664: 'jxta_advertisement_get_string' : cannot convert parameter 2 from 'const char [5]' to 'Jxta_index *'
This is usually a Unicode vs. ANSI error. Try putting an L in front of the string literal.
[edit]
Now that I've gone back and read your post, my suggestion was way off. Sorry about that.
[/edit]
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi thanks for that but now i get a error message saying cannot convert parameter 2 from 'const wchar_t [5]' to 'Jxta_index *
|
|
|
|
|
It must be something else then. Rather than code something up to find out for sure, I was just taking a stab at something common.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
no problem iv been having a lot of trouble getting Jxta-c to actually work
just about got its shell to run but it wont connect to the network found that it uses a xml file called Platformconfig for its settings and the Confgui which is the problem in question is supposed to generate this
|
|
|
|
|
Try:
Jxta_index j;
peername = jxta_advertisement_get_string((Jxta_advertisement *) pa, &j);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
thanks for that but that gives me a error saying no appropriate default constructor available
|
|
|
|
|
What statement is generating this error? What Jxta_index constructors are available?
See here for more.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|