|
CFile myFile("theFile.dat", options);
int nSize = 663;
char* buff = new char[nSize];
myFile.Read(&buff, nSize);
delete [] buff;
I think this is what yer after...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
If you are into iostream s, this is the way:
std::istream in;
std::string str;
...
std::getline(in,str);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That's definitely the way I'd do it (you need an ifstream though not an istream) you get all the flexibility in the world and code re-use goes up 'cos you're not having to talk MFC. You can always use .c_str() on it if you need to get down and dirty. Why does anybody use anything else?
I hear The Prisoner and 7of9 aren't getting along too well these days.
|
|
|
|
|
how do you run two for's at once?
|
|
|
|
|
int i = 0 ;
int j = 0 ;
for ( ; i < 10 && j < 10 ; ++i, ++j)
{
}
Maybe that would do the job. I originally put i++, j++, but then I thought "Holy crap, I'll get blasted by all those c++ efficiency coders out there"
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
Please step to the rear of the car and make room for more victims. - John Simmons the Outlaw programmer, 1st Feb 2002, in the lounge
|
|
|
|
|
|
Ooops!
I misunderstood your question.
Please ignore my reply
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Don't feel too bad Nish, if he had spelt his topic correctly it would have been easier to understand.
Run two For's at once
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
Please step to the rear of the car and make room for more victims. - John Simmons the Outlaw programmer, 1st Feb 2002, in the lounge
|
|
|
|
|
Roger Allen wrote:
Run two For's at once
I thought he was talking about beer...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
You can also do:
for (int i=0, int j=0; i<10 && j<10; ++i, ++j)
Just wanted to blow that disgustingly UGLY bit of code out of the water. Three lines for a loop for God's sake. Talk about slack. When I were a lad we 'ad 2k and bloody grateful for it we were too. Eee, young 'uns.
Anyway, what's so wrong with writing efficient code then?
i1.2sqrt(u).bcos(ur)sec(c) but b4.isqrt(u).ru/16
|
|
|
|
|
for(i=0;i<j;i++)
for(a=0;a<z;a++)
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
that is what i had but it ran the first one then the second one over till that had finnished then it ran the first one again and then started over the first one again
|
|
|
|
|
Yes.
The only way to actually have two 'for's running together is to have two threads. But then that's not what you want. You want two variables to be incrementted in parallel. For that you can do what Roger suggested...
But there you have one 'for' with two variables getting incremented on each iteration.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
|
Hi!
I would like to play an audio CD and be able to manipulate the datas from the CDRom drive(put them in frames and send them through a network).
I m a bit lost... what should I use:MCI or AVIStream?
If you have codes on which I can start learning...PLEASE send them to me...
(sorry for the english, I speak french...)
starn@skynet.be
Thanks a lot!!!!
|
|
|
|
|
My app is COM using WTL. On the main menu, we have a Reports pulldown menu. On the Reports options, there are right arrows indicating another pulldown menu. For other dialogs, we have buttons on the bottom (standard OK, Apply, Cancel), including a Reports button. They tried to implement it so that a context menu appears upon pushing the Reports button, but they had no luck. Right now that bottom button just brings up another dialog displaying options. Has anyone done this kind of stuff before?
Please help if you can
Thanks,
Lilian
|
|
|
|
|
That's simple, check out the Buttons section at this site for menu button samples. It just involves handling the WM_COMMAND message and calling TrackPopupMenu().
--Mike--
"There are only a limited number of jobs where they will ask to see the sausage. Most of them are in movies."
-- Christian Graus, 2/11/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I have a CMsFlxGrid control in a CFormView. I have two (2) questions which I am struggling with.
1. Is there any way to make a row in a grid two lines deep? That is, they can type information on the first line of the row, hit enter and continue typing information on the second line of the same row. So you have something like:
-----------------------------------
line 1 text | just one 1 of text
line 2 text |
-----------------------------------
So there are two (2) columns and one grid row, but the single grid row has two (2) lines of text.
2. Is there any way of adding a push button to a cell? Examples are cherished
Please, please, any response any one can give me will be greatly appreciated. There is not much documentation on this control.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
It's very difficult to make all of them...
The first option is not possible.
And the second one, is possible using a simple trick, only put the button, over the grid, in the point that you want. You can get the cordinated of a cell, and with that you can put the button in the correct place, usin SetWindowPlacement...
Regards....
Carlos Antollini.
Sonork ID 100.10529 cantollini
"The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a software patch and a user with an idea."
|
|
|
|
|
i have used INTtoHEX to convert some text to HEX but now I need to convert it back to read able text any cues?
AnsiString EditText = RichEdit1->Lines->Text;
for (int i=1;i<=EditText.Length();i++) {
RichEdit2->Lines->Text = RichEdit2->Lines->Text + IntToHex(EditText[i],2);
}
RichEdit1->Lines->Text = "";
RichEdit1->Lines->Text = RichEdit2->Lines->Text;
RichEdit2->Lines->Text = "";
|
|
|
|
|
There some articles in CP.
Check this
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Very crude, but i think this should work (send 2 chars at a time in your case)
int Hex2Int(char* hex)
{if (!*hex) return 0;
int tmp = 0;
if (*hex >= '0' && *hex <= '9')
tmp = *hex - '0';
else if (*hex >= 'A' && *hex <= 'F')
tmp = *hex - 'A' + 10;
else if (*hex >= 'a' && *hex <= 'f')
tmp = *hex - 'a' + 10;
return (tmp << (4*(strlen(hex)-1))) + Hex2Int(hex+sizeof(char));
}
/moliate
|
|
|
|
|
sorry i am not sure how to implement this on to a decrypt button?
when i press encrypt i get something like this:
68
65
72
65
73
20
77
68
61
74
20
68
61
70
70
65
6E
73
0D
0A
and that says: heres what happens
so i need the button to change it back from numbers to the text?
|
|
|
|
|
Perhaps it is not the best solution for you. Anyway, what the function does is taking a string like |6|8|\0| and turn it into the number 104 decimal - the ascii code for 'h'. If you can access each line as a string, you can send it to the function and get back a char. The string must be null-terminated, though.
/moliate
|
|
|
|
|
Those are all ASCII character values displayed in hex. Try sprintf with a %c format specifier to get the text character.
See the docs on sprintf for more details.
|
|
|
|