|
Dear Sir,
I am assigned to draw ( with GLUT ) line chart and Bar chart for ( say = 5 ) inputs. I checked my books and on net , but could not find any helpful coding.
Therefore I uesd fundamenta method to get to a solution. I used six line ( Bresenham algo ) segments to define Two major axes amd foue head - to - tail line ( edges )segments
to define five ( vertices ) Points .
For bar chart , I have drawn five rectangled of a small width and ordinates to define the height ( parameter ).
The result just fulfills ther intent , but is too crude , messy and unpleasant to look at. No parameters or markings .
My query is that ....................
is there any function namely < Draw_BarChart> . like we have < Draw_Circle> or < Draw_Line> in the library, or custum -written . At least I could not locate one.
If there exiats such a function < Tool > , please provide me the link , to work upon. I will be futher obliged , if I can get < charts> code in C++ or any other version of C .
Thanks ,
ah.
|
|
|
|
|
how can i perform HTTP GET and POST using C++?
|
|
|
|
|
if it is unmanaged c++, you can use XMLHTTP class and its methods open, send etc in MSXML library.
In .net i guess HTTPWebResponse, HTTPWebRequest are similar. Of course you can send and recieve web urls using these classes, but I am not sure whehter we can specify the request mode as GET/POST.
rgds..milton.
|
|
|
|
|
Mridang Agarwal wrote: ow can i perform HTTP GET and POST using C++?
if Unmanaged,as it sound like! , try http://www.codeproject.com/internet/simplehttpclient.asp
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
hi all
i am a beginer programmer. so u might have feel bore to read this problem.
i dont know what is the use of extern.
i wrote a file like
int i=10;
then save it as t.h
then i included it in my program as
#include "t.h"
then i got the value of i just by using
printf("%d",i);
it printed the value of i 10
but i thouht that i would have to use the statement
extern int i;
to get the desired output?
if we dont want extern here what is the exact use of extern.
pls help me.
shamnar
|
|
|
|
|
In one .CPP file declare the variable at global space
int ix;
In the file that you want the variable to be used or say stdafx.h that is included in all the other files write:
extern int ix;
The extern keyword confirms to the compiler that "ix" is an int declared in some other .CPP file.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
but without using extern, just by an include statement i got the desired o/p.
why do we go 4 such a complex concept?
shamnar
|
|
|
|
|
Without extern, every translation unit (cpp file) in which you included i gets its own i. That is, each translation unit reserves memory for the variable.
Did you try including thhe file in multiple cpp files? You'll find that the code won't link, you'll get linker errors complaining about multiple symbol redefinitions for i. The reason is the same, each cpp file has a global i, so the linker doesn't know which i to use.
The solution is to define the variable in one cpp file and to declare the variable extern in the header file. This way, all cpp files including the header files will recognize that variable is defined somewhere else.
Does this answer your question?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
thank you..........
shamnar
|
|
|
|
|
Hi,
Iam trying to implement a cross-platform encryption system.
i.e, in windows i will encrypt a file and in Linux will try to decrypt it and viceversa. The same encryption algorithm can be used on both platforms.
NET has Cryptography namespace in which all this algo are implemented and API's available. But when we go in to linux , we cannot use this .NET API's. so, some libraries muist be available to implement this algo in both platforms.
I got some info on using OPENSSL libraries which i can use for implementing encryption algo. But some problems is ther when it comes to cross platform.
So, need some guidelines and ideas for this.
Please mail me if u had come across similar situation and help in the same.
Thanks.
Mani
|
|
|
|
|
Can u be more specific abt the problems u faced.
For cross platform code usability,the general practice is to make code in c/c++,STL. Then compile/link it on diffrent platforms which ever is required.
There are lots of free source code available on net which compiles with both Microssoft CL.exe and the unix/linux GCC.
cheers...milton.
|
|
|
|
|
What I need to do is this:
To take a structure (or a class that contains only variables) then convert it somehow to an array of bytes, so i will be able to send it with the Write function of the SerialPort Control.
On the other side of the port i need to do backward process
Can anyone help me with this one?
thanks
|
|
|
|
|
Call createfile to get a valid handle to the port:
hPort = CreateFile(lpszPortName, GENERIC_READ | GENERIC_WRITE, 0, NULL,<br />
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |<br />
FILE_FLAG_OVERLAPPED, NULL);
Then set the device control block with appropriate baude rate and parity bit settings and other settings.
<br />
DCB dcb; <br />
dcb.DCBlength = sizeof( DCB ) ;<br />
GetCommState( ufp, &dcb ) ;<br />
dcb.BaudRate = baud;<br />
SetCommState(ufp, &dcb);
Now you can start writing to the device.
WriteFile(hPort, bfr2write, dwBytestoWrite, &dwBytesWritten, &OVERLAPPEDWrite);
To Readfrom the file:
ClearCommError( hPort, &dwErrorFlags, &ComStat ) ;
dwLength = min( (DWORD) MaxLength, ComStat.cbInQue );
if (dwLength > 0) {<br />
fReadStat = ReadFile( hPort, lpzBlock,
dwLength, &dwLength, &osRead ) ;<br />
if (!fReadStat) {<br />
Err("ReadSPort");<br />
dwLength = 0 ;<br />
ClearCommError( hPort, &dwErrorFlags, &ComStat ) ;<br />
}<br />
}
cheers...milton.
|
|
|
|
|
Thanks,
But in this way I don’t really use the SerialPort Control that .net 2 gave me.
Do u know how to do it with the SerialPort Control?
|
|
|
|
|
|
I am working to upgrade an application to manadeg code which has to use unmanaged DB functions and a large DB created with them.
I have been able to read the records sequentially, and lets say I have read a value of an existing record key field(long) and named it Currtmp, could anyone perhaps give me an opinion on my try (based on an earlier piece of advice by Milton KB)
String ^crpt = Currtmp.ToString();
pin_ptr<const void*=""> tnoptr = static_cast<marshal::stringtohglobalansi(crpt)>.ToPointer();
d:keyfind(..., tnoptr, ...);
In compiling I receive the error
error C2061: syntax error:identifier 'StringToHGlobalAnsi'
When editing the line of pin_ptr ..., the editor gives after the two colons as one alternative this 'StringToHGlobalAnsi',
but in compiling I get the above error. Is this completely wrong thinking.
When I move the mouse focus on the line to the point over the 'StringToHGlobalAnsi' a box appears containing
static System::IntPtr System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(System::String ^s)
copies the contents of managed System.String into unmanaged memory, converting into ANSI format as it copies
so at least the text would indicate that I could be on the right road, but ...
I have also tried several other identifiers instead of 'const void*', with similar results. The native code function needs the identifier (const void*).
Ilkka Pitkänen
|
|
|
|
|
I juz went thru my reply to your previous post.
There I suggested to use __gc char* and it was a .net 1.1 syntax. This might have failed for you if you are using .net 2.0.
But in your new code, you are using pin_ptr . This is not required if you are using StringToHGlobalAnsi . Because StringToHGlobalAnsi will allocate memory in the unmanaged heap and .Net GC can't do anything on this unamaged memory. So you dont have to pin it to prevent from memory relocation.
Try below coed. This works in 2.0 with /clr:pure
long Currtmp = 117;<br />
String ^crpt = Currtmp.ToString();<br />
IntPtr intptr = Marshal::StringToHGlobalAnsi(crpt);<br />
d:keyfind(..., intptr.ToPointer(), ...);<br />
Marshal::FreeHGlobal(intptr);
cheers...milton.
|
|
|
|
|
I have a native c++ class in a native code dll.
I wrapped it with a managed c++ class library in visual studio 2005 by:
1. Creating an instance to the native class in my constructor and deleting the instance in the destructor.
2. Implementing all of it's interface and calling each matching function.
I was able to compile the class library succesfully.
When attempting to use it in a CLR console application I Added a reference to it in the application.
The autocomplete recognizes the classes and recognizes the public functions of the classes.
My problem is that when I compile the program i get the following error:
error C3767: 'XP_Talk::XPMyClass::Init' candidate function(s) not accessible.
Why does this happen? XPMyClass::Init was declared public and is seen in autocomplete as public...
So why do i recieve this error and how do i resolve the problem?
|
|
|
|
|
Make sure ur managed cpp class declared with modifiers public ref and method has public modifieres.
namespace XP_Talk{<br />
public ref XPMyClass{<br />
<br />
public:<br />
<br />
void Init();<br />
<br />
}<br />
}
milton
|
|
|
|
|
Since you say that you declared the functions as public there is only one case which i ran into in which i recieved this error.
If one of the functions in the managed class library recieves an unmanaged type then verify that the native class you are wrapping (it's header) is declared as public.
//native class
#ifdef _MANAGED
public
#endif //!_MANAGED
class UNMANAGEDDLL_API CUnmanagedDll
{
public:
CUnmanagedDll(void)
{
}
double Add(double First,double Second)
{
return (First + Second);
}
// TODO: add your methods here.
};
In this case the function Add does not recieve an unmanaged type.
If it recieved an unmanaged object for instance than the public would be mandatory.
|
|
|
|
|
Hi ,
Can any one please let me know how can i use the vc++ code in c# using the concept of Managed and Unmanaged code?
Bcoz i dot have any idea about the interface so please suggest me about how i can go ahead.
Thanks
|
|
|
|
|
|
RajArchana wrote: Can any one please let me know how can i use the vc++ code in c# using the concept of Managed and Unmanaged code?
Bcoz i dot have any idea about the interface so please suggest me about how i can go ahead.
You can write a mixed-mode DLL (using C++/CLI) that will expose a managed interface that C# callers can use. You'd have to know C++/CLI syntax, and how to wrap native classes for consumption from managed callers. Check out the C++/CLI section on Code Project and MSDN for a bunch of articles on this topic.
Regards,
Nish
|
|
|
|
|
Hi all, have a nice day.
I want some graphic base codes, include DDA, Midpoint and Bresenham algorithm of line, circle, ellipse and parabola (3 x 4 = 12), fillcolor and clipping.
Would you like send me?
Thanks very much.
My email: duyviet2412@gmail.com
|
|
|
|
|
And this has what to do with "managed and mixed-mode C++ programming"?
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|