|
Hai
i want to send a string to the controller board through usb port.I have a gui application where iam controlling operations like reading adc,blinking led reading temp etc.Now i want to send a string .what i need to do
satya
|
|
|
|
|
satyanarayanarao wrote: to the controller board
Do you have an API for your board ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
|
satyanarayanarao wrote: to the controller board through usb port
USB doesn't work the same way as a serial port: you don't send data on a port but you communicate with a driver instead. And the driver is responsible for teh communication over the USB with the connected device. What kind of device is connected on the USB ? You certainly received a driver with the 'board' and you probably received documentation with it.
To communicate with the driver, you first need to get a handle through the CreateFile function then you can exchange information by using DeviceIOControl function. The code you need to pass to this function are device dependant so you need to check your documentation.
|
|
|
|
|
Hi everyone,
i need to access a private Member of a friend class from a derived class LOL
Class A with private Member AA
Class B has a Member of kind pointer on class A
So B can't access AA.
Using the friend function friend class A, the class B can access AA
All these classes are in a component, so i can't modify the source code.
Now i derive the class B and call these class for example MyB
In MyB i must also use the Pointer to the class A with his private Member.
But then i get the error : C2248
I added also the friend class A to MyB.
Anyone an idea?
Big thanks
|
|
|
|
|
C2248 isnt an error. Can you plz tell what is the error??
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Aqueel wrote: C2248 isnt an error.
Sure it is.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
C2248 = members of a derived class cannot access private members of a base class. That's all, if you cannot modify the source, then it can't be done, at least not without monumental hacking.
|
|
|
|
|
Oh thanks Christian. I am working with Visual C++ since 4 years and now i have been informed that C2248 is an error code.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Hi Aqueel,
you have two sorts of errors:
Compile Errors, which produces during the compilation, they start always with C and an ID
Then you habe Linkage-Errors, they start with LNK and an ID
Thanks Christian, so it's totally the problem of the Component-Support to resolve the problem
Thanks anyway
|
|
|
|
|
Hi Baerten Thank you. That's great to know.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
How to reduce bitmap colors from 24 bits to 256 or less?
my purpose is to save rich colored bitmap to gif file.
As I test, CxImage can not save rich colored bitmap to gif file properly because it can not reduce colors properly.
CxImage is fine to transfer 256 color bitmap to gif file.
So I need source code (similar to CxImage etc) to reduce bitmap colors first then use CxImage to transfer it to gif file.
|
|
|
|
|
GDI+ will do this for you, although it may not dither in the way you're hoping.
Dithering is the process you want, that's the word to google to get more info.
|
|
|
|
|
Hey all, Iam currently trying this small example to understand the pointers, arrays,etc. in C.
When I try executing the following , the program breaks inside fruitexec() as it would pass the list FrList sometime and not other time.
Why? Isnt the list passed the right way?
Am I pointing at differnt location?
Any help appreciated.
struct Fr_t<br />
{<br />
<br />
char * name;<br />
<br />
char * colour;<br />
<br />
};<br />
static struct Fr_t g_fr[] =<br />
{<br />
<br />
{<br />
"Apple",<br />
"pink",<br />
<br />
},<br />
{<br />
"Mango",<br />
---<br />
<br />
},<br />
<br />
{<br />
<br />
},<br />
<br />
{<br />
<br />
},<br />
{<br />
0,<br />
0,<br />
0<br />
}<br />
};<br />
<br />
struct FrList_t<br />
{<br />
char * name;<br />
} FrList_s[4];<br />
<br />
all the above structs are declared globally.<br />
<br />
<br />
<br />
static struct Fr_t* pickFr( struct Fr_t *Frtcollection, const char * name ) <br />
{<br />
struct Fr_t * what = 0;<br />
if ( Frtcollection )<br />
{<br />
<br />
for ( what = Frtcollection; what->name; ++what )<br />
{<br />
if ( strcmp( what->name, name ) == 0 )<br />
{<br />
break;<br />
}<br />
}<br />
<br />
}<br />
<br />
return ( what );<br />
}<br />
<br />
<br />
<br />
<br />
int fruitexec(int farm, struct FrList_t * Fr_List)<br />
{<br />
int next_fr = 0;<br />
struct Fr_t* fruit = 0;<br />
--------<br />
------<br />
Fr_List = & (FrList_s[next_fr])<br />
if( FrList_s[next_fr].name )<br />
{<br />
fruit = pickFr( g_fr, Fr_List->name );<br />
}<br />
<br />
printf( "The name is %s.\n", FrList_s[next_fr].name );<br />
<br />
<br />
-------<br />
---------<br />
}<br />
in main, we assign <br />
{<br />
FrList_s[0] = "Mango";<br />
FrList_s[1] = "Apple";<br />
...<br />
....fruitexec(..., Fr_List_s);<br />
}
|
|
|
|
|
thathvamsi wrote: FrList_s[0] = "Mango";
FrList_s[1] = "Apple";
where are you reserving memory for these ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
thathvamsi wrote: static struct Fr_t* pickFr( struct Fr_t *Frtcollection, const char * name )
is static here necessary ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
where do i reserve memory? and how?
if i dont put static, the warning message i get is "no predefined prototype"
|
|
|
|
|
allocating memory:
char *name;
name = new char[5];
as for the function, simply put the prototype of the funtion after your global declaration.
int myfunc(void);
bla...
int myfunc(void)
{
}
Are you writing C or C++ ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
iam writing C.
Do I have to do this for every structure member?
is that why you think the code is breaking?
|
|
|
|
|
thathvamsi wrote: Do I have to do this for every structure member
Yes. Because
char *str;
str="Hello";
simply does not work. You háve to allocate memory somewhere for your strings.
char str[5];
str="Hello";
thathvamsi wrote: is that why you think the code is breaking
Not only (see Mickael's comment). This is something that will cause your app to crash asa it can compile.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Rage wrote: char *str;
str="Hello";
simply does not work.
Sure it does. The string literal "Hello" resides at a static memory location that str points to.
Rage wrote: char str[5];
str="Hello";
Are you kidding (str is not an l-value)?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Are you kidding
I was too lazy to strcpy .
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Your type and variable names are really confusing, but I think the problem is you're mixing up FrList_t and Fr_t in your pointer types.
|
|
|
|
|
HI all,
I want to get notified when we change from 1 doc/view to other in a MDI application. Thanks in advance.
Regards
Gan
|
|
|
|
|
create a new MDI app, then copy code to right places.
there are lots of modifications for a large project.
The work depends on your expeirence - I don't think there is any good method to do that.
|
|
|
|