|
Yes and it should be
7f 80 1a
Rostfrei
|
|
|
|
|
Rostfrei wrote: char buffer2[100] = {0x7f, 0x80, 0x1a};
Here is the problem.
Make that unsigned char buffer2[100];
Jesus Lives Forever - Amen <marquee direction="up" height="40" scrolldelay="10" step=".5" scrollamount="1" style="background:#99ccff;border-bottom:thin solid 1px #6699cc">
--Owner drawn
--An eye for an eye makes the whole world blind.
--Jesus is Lord
|
|
|
|
|
Yes! It works now!
Thank you!
Rostfrei
|
|
|
|
|
In my oppinion there is way too much printf ing in C++ code. Why not something like this?
<br />
#include <sstream><br />
#include <iomanip><br />
<br />
string print_buff;<br />
BYTE buffer2[100] = {0x7f, 0x80, 0x1a};<br />
<br />
for(int i = 0; i < 3; i++)<br />
{<br />
ostringstream ss;<br />
ss << setw(2) << setfill('0') << hex << buffer2[i];<br />
print_buff += ss.str();<br />
}<br />
Steve
|
|
|
|
|
|
Hello!
By looking at the code I know it should work, but it just doesn't and I don't know why. I have an array of hexadecimal numbers (char)
00 1C 61 1A 80 02 07 80 A1 08 06 06 2B 0C 00 81 34 01 A2 03 02 01 00 A3 05 A1 03 02 01 01
when I try to convert it to string the result in print_buff is only "0".
Rostfrei
|
|
|
|
|
In most C++ compilers, char is a signed data type. This means that values greater than or equal to 0x80 interpret the high bit as a sign bit. You are using an integer format %2.0x , so it extends the sign bit.
Try this:
string print_buff;
<br>
char buffer2[100] = {0x7f, 0x80, 0x1a};
<br>
for(int i = 0; i < 3; i++){
char a[3] = {0};
sprintf(a, "%02x", (unsigned)buffer2[i]);
print_buff.append(a, 2);
} The (unsigned) cast converts the character to an unsigned int . I also changed the format slightly.
Software Zen: delete this;
|
|
|
|
|
Could you please help me in my college project work, with sample code..
1) 5 students to input on one program (5 items per record, where 2 are key items)
2) should have a small menu (input, change, delete, report & exit)
3) codes to store input data in a single file at server
4) simultaneously access server to retrieve data on key items
project can be : student marks, books library, cinema name/artists, or any thing you feel comfortable
wrongly i put this in c++/CLI & didn't get reply, the mistake is mine.
Best Regards,
Bobby
|
|
|
|
|
|
I'm afraid your mistake is this: The CP forums are here to help you with an existing program, not to write it for you. Try writing the code yourself, and then come back when you've got a question.
Good luck.
Software Zen: delete this;
|
|
|
|
|
I recently had a bit of an issue where I was looking for a string tokenizer component. I posted on c.l.c.m, and was informed that STLSoft had one called "string_tokeniser" (note spelling). This both amused me and irritated me cos I use STLSoft and had done a search (for "tokenizer") and found nothing.
My experience of STLSoft over the last 2-3 years is that the code's great but the docs suck. So I posted on their newsgroup, complaining about the yawning gap between the quality of the code and the docs, and also asked why the author(s) doesn't post to Code Project.
It was good that I got a swift reply, but like a bad lawyer who doesn't know the answer to the question (s)he's asked, I got snapped on my own challenge, as Matt Wilson from STLSoft asked if I would consider posting to CP. So, I've created a new account - forgot my old details :$ - and will have a go at putting my size 12 where mt mouth is.
So, I was wondering whether anyone in CP already used STLSoft (http://stlsoft.org/[^]), and whether they'd had any experiences - good or bad - that might tallie with mine, as a good place to start.
Fanks
Danny T
-- Ain't no monolithic framework yet worth the hassles --
|
|
|
|
|
hi
i got how to create and run service, but i dont know how to make a service to a specific user. I have passed the last two parameters in the createservice function (username,password) even though i can't do it.
i.e we can't modify if we have logged from another user. please help me in this problem.
sudheer
|
|
|
|
|
lately i been tinkering around with dll files trying to learn more about them and developed a small app that loaded the functions i use a lot across most applications i make from a dll file. the application in a sense works but the main issue i am having is parts of the program do not load as they should, and load at wrong times, maybe a screen or 2 after it should have been displayed. is there something i could do to prevent this from happening or maybe fix the problem?
|
|
|
|
|
swatgodjr wrote: parts of the program do not load as they should, and load at wrong times, maybe a screen or 2 after it should have been displayed
That is not clear. Do you mean the dll does not load when it should? Does it load late? Sorry it does not seem clear. Please give more details.
Even though I may not be able to help you someone will.
this is this.
|
|
|
|
|
well i fixed part of it, see i made my own functions to format menus in a console app, it would display all but the last line and i think for that, the problem was because when that line gets displayed i have the program ask the user for input.
but i also have the same issue some place else, i made it so if incorrect input is detected, it would load a custom error function out of the dll file and display a formated error message. if the functions are inside the program it works fine but when loaded from a dll to be used inside the exe it causes this problem.
and about my question, the dll file loads like it should but some how lines of text will not appear from soem of the functions where they are supposed to.
|
|
|
|
|
Sorry, I have never tried what you are doing. It sounds like the dll-function is displaying the error instead of the main program. You can make the dll function so that it only returns the error text message, instead of displaying it also. Take the string from it, and display it in the main program.
And are you using cout ? If you are, then you know cout buffers a lot of output, so the displayed output can get messy. Try using something like cprintf . I think that should do it. If it doesn't then try the above ideas. If that doesn't help either, then create a new thread, and try posting some code with it as well, hopefully someone will help you.
this is this.
|
|
|
|
|
thank you, that worked exactly as i was wanting it to
|
|
|
|
|
|
I think the problem is because you are setting a 32x32 icon. You can try creating a new icon resource with dimensions 16x16 . And use LoadIcon(...) to load it. That should do it.
this is this.
|
|
|
|
|
|
Owner drawn wrote: with dimensions CX_CXSMICON, and CX_CYSMICON
You must mean: SM_CXICON and SM_CYICON .
Owner drawn wrote: but I wanted the other one
I am not sure what you mean by that.
Anyway here is a standard way:
HICON hi = AfxGetApp()->LoadIcon(IDI_ICON1);
this is this.
|
|
|
|
|
khan++ wrote: You must mean: SM_CXICON and SM_CYICON.
Yeah.
khan++ wrote: I am not sure what you mean by that.
If you have created a dialog based app in vs2003.net then you will know. I wanted the Icon that gets displayed for the control menu of a dialog. But it appears rather odd.
khan++ wrote: HICON hi = AfxGetApp()->LoadIcon(IDI_ICON1);
This returns a 32x32 icon.
Jesus Lives Forever - Amen <marquee direction="up" height="40" scrolldelay="10" step=".5" scrollamount="1" style="background:#99ccff;border-bottom:thin solid 1px #6699cc">
--Owner drawn
--An eye for an eye makes the whole world blind.
--Jesus is Lord
|
|
|
|
|
I have never loaded a multi-icon icon (not sure about the term). That is: an icon which contains multiple sized icons, like: 16x16x4 , 16x16x8 , 32x32x4 ... (width x height x bits/pixel) within one .ICO file. You can do a search on it.
As I said in my first reply that you can create a new 16x16 icon resource, and try loading that one.
this is this.
|
|
|
|
|
tray icons are supposed to have a resolution of 16x16 pixels. if you're loading a bigger one windows will shrink it and you'll get some odd artifacts.
so if you want it to be displayed like in your resource editor you need to make it 16x16.
saludos
|
|
|
|
|