|
|
Thank you
|
|
|
|
|
Hi,
I would like to convert a char into an int and vice versa.
For instance;
char a = '3';<br />
int a = 3;
Thanks in advance,
|
|
|
|
|
|
One way would be:
<br />
============================<br />
char chA = '3';<br />
int nA;<br />
char chValue[32];
chValue[0] = chA;<br />
chValue[1] = 0;
nA = atoi(chValue);<br />
============================<br />
char chA;<br />
int nA = 3;<br />
char chValue[32];<br />
itoa(nA, chValue, 10);<br />
chA = chValue[0];<br />
============================<br />
SkyWalker
|
|
|
|
|
Hi Mircea, I used both the array and * implementations and it worked, thank you very much...
Thanks to Dunn also.
|
|
|
|
|
I also would like to ask that is it possible to store for example number 14 in one character array element?
I mean;
if( myCharArray[2] == 14 )<br />
cout << "I want this" << endl;
Thanks,
|
|
|
|
|
if number is only one digit then its simple.
char c = '3';
// char => int
int i = c - '0';
// int => char
c = '0' + i;
|
|
|
|
|
Any source code?
please contact:
max_xiayi@hotmail.com
|
|
|
|
|
Friends,
I've created an application in VC++ 6.0. There is a dialog in it on which i dropped various controls and associate class with that dialog.
Now, i am creating another project in VC++ 6.0. I want to use the same dialog template and its class in this project.
Please tell me how can i "import" dialog from one project to another. Obviously i can reuse class header and cpp, but how can i import dialog template ??
|
|
|
|
|
If you mean the dialog resource, do it this way. Open the old project and simply copy the dialog resource to clipboard. Then, open the new project and paste it into its resource script in the resource view window. Should work.
|
|
|
|
|
unfortunately this is not working in case of different projects. If we have two dialogs in same project then we can copy-paste resources.
|
|
|
|
|
|
Hi All, my CListCtrl's DeleteAllItems() is not working. Although it is returning me non-zero and according to MSDN it returns non-zero when it succeeds but it is not erasing the contents of List control. Any help/advice?
Regards,
Still Alone in this beautiful world
My Articles
|
|
|
|
|
Sorry, I have done it. It was another fault.
Still Alone in this beautiful world
My Articles
|
|
|
|
|
you can send the message LB_RESETCONTENT to the list box
|
|
|
|
|
How to handle the modem connection on the line?
For example i want to call a connection dialog, where i choose the provider of internet (simple connection dialog in windows - how to call it?, i see it when i open the Internet Explorer - it offers me to get online, i want to call such window). Then i want to know - if i connected, so if the connection breaked, i want to handle this situation in my programm - how to do it?
|
|
|
|
|
|
Hello everyone,
I am working on a network program and
I want to lock the desktop and then put
something like a edit box on it.
How can I do that?
Best Wishes.
Thank.
|
|
|
|
|
Hello maybe one of you guys can help me out. im trying to write a program where it will execute another program with command line parameters.
Like in a bat file i would use
program.exe %param
just put it in a bat file and be on my way.
I would like to do this in C++. I need to make a exe that will execute a file.exe with %param aka %1.
plz lemme know. thanks.
|
|
|
|
|
Maybe you can use the "system()" function...
#include <process.h>
void main(char args[])
{
system(args);
}
so it can be for example as MSDN shows:
system( "type readme.txt" );
|
|
|
|
|
If you're under Windows, try using ShellExecute.
|
|
|
|
|
|
Hi!
I'll preface this by saying I'm a novice with C++ and the majority of my work is VB .Net, although in the past month I've had to take a self-crash-course in C++ for a project with some severely short deadlines, so I'm able to grasp basic C++ concepts. My C++ work at the moment involves writing my own C++ DLL to act as a join between a VB .Net application I am writing and an SDK that is designed for and writen in, C++ (I unfortunately lack the time to a solid course in C# and work with a more compatible pair of languages). The reason I'm writing this DLL is because certain uses of data types (unions being my biggest problem) used by the SDK aren't replicable in VB .Net (at least not to the best of my ability), and it's been easier to reproduce the functionality I need in C++ and send the data my VB .Net app needs back up the line.
Coming to my problem, the SDK is for a Canon line of digital cameras, and is used for manipulating the camera from a PC (taking pictures and getting live video, with a whole bunch of additional features on the camera you can access). My goal is to be able to take pictures (which I've fully accomplished), and get live video so that the user of my application can see what they're going to take a picture of before they do so. To put this in context, the app is for taking security badge photos.
The SDK handles video capture as sending to the PC what the digital view-finder on the camera can 'see', and it does this at a frame rate I think to be on the order of 25-29 fps, via an event call procedure I vaguely understand. Basically I create a pointer for the event that the initial function recognizes and then runs every time a frame of data is sent in from the camera, and then I write what code I want to in that event to display images. The event's parameters are a void field that is a buffer holding the data of the image, an unsigned long field holding the size of the buffer, another unsigned long field for the format (a 0 or 1 that I set as a seperate parameter of the initial function call to set the images coming back as bitmap or jpeg format, I'm using bitmap), and one more unsigned long field that I can use at my hearts content, but doesn't play any role in my needs.
Basically, I want to take what's in that buffer, and get it to my VB .Net application as a Byte array (in the .Net sense of the type) that I can then turn via a .Net memory-stream that data into a bitmap image (that final step being something I've done countless times before). My attempts at the moment have been to use a 'global' variable within my C++ DLL that I try to fill with the data from the buffer, and then I have a function of my own that returns the data from that global variable, and from my VB .Net app I just call that custom function however many times a second I want to.
The problem is I'm not getting any usable data, and my Byte array is showing up as having been accessed, but it has a length of 1. I presume this is because the data is being copied to it, but because I'm not so crash hot with C++ data formats, only the first byte of data is going into my array and nothing else (thus a length of 1, which obviously doesn't get me much).
I can provide sample code if it will help, but I wasn't sure it's necessary because I think my problem is not something particularly specific. Using a global unsigned long field I returned using my custom function, the Size field I mentioned earlier and it shows up as a little over 23,000, which would make sense for a 320x240 bitmap from the viewfinder (default size). I don't really know how to measure the buffer; I know of the sizeof() method but that for some reason was returning 4 to me when I used it on the buffer variable.
So my basic question follows my subject line (I hope so anyway!): How do I take the data out of a buffer that is of the Void data type, and copy it into a type that I can grasp from VB .Net as a Byte array?
Again, for reference. I have the buffer as a Void datatype, and the Size of the buffer, and I have the code in place to draw from a global variable that would be filled every time the viewfinder event is run by the SDK. My problem is I have had zero luck turning the buffer into a VB .Net Byte array.
Thanks so much in advance for any help or suggestions anyone can offer!
|
|
|
|
|
Could anybody please explain to me how to compile a source code split across 3 files, namely header file, implementation file and the driver file where the main resides. I tried every trick to no avail. I've tried the unix make utility but it was of no help. For some reason the linker may not be linking the header file because all the objects I created in the main are declared as undefined by the compiler.
|
|
|
|