|
Thanks, this and the other response were exactly what I was trying to prove. Unfortunately I'm not proficient enough to have done this myself.
Thanks again.
Jeff Patterson
Programmers speak in Code.
http://www.anti-dmca.org[^]
|
|
|
|
|
A reference is nothing but a constant pointer.
|
|
|
|
|
All,
I am very new to Visual C++ as my experience has been with VxWorks in embedded real time systems. So, I am a bit overwhelmed with the steep learning curve that I am facing.
I have spent a couple days getting an example program to run. This consists of a small form with a main menu that has a pulldown with a couple selections. There is a button on the form that displays text in a message box when selected. The first pulldown I use to open up a file open dialog box which passes back a file name. The good news is that there is only 1 more thing that I need to integrate at the moment.
When the user selects the file I need to open it up and do a bunch of processing, looking for certain information and outputting it for the user to see. The files are huge (50GB) and contain binary data. Finding the data that I need and converting it to readable form via something like printf is not the problem. What I am wrestling with is how to display that data in a GUI window.
Ideally I would like to have a "pane" in the lower portion of my main form that I use that would contain a scrollable section where I can dump the data and let the user look at it. This would be very similar if not identical to the build or debug pane that exists in the Visual C++ development environment. Where the compilation information goes. That is exactly what I want.
The problem that I have is that there doesn't appear to be any "windows components" that I can easily slide over from the toolbox that perform this function. I have read a bunch of material about creating separate windows and then sending messages to those windows, but that is not ideal. I also have read about the CSplitterWnd Class that allows for the user to split and resize windows to display several views of the same document. This is overkill for me. I just want a running log of the printf equivalent stuff that I want the user to see, in a window that he/she can scroll up and down to view all the contents.
If anyone can point me to the information in the MSDN library or online I would greatly appreciate it. Any pointers to code samples would be very helpful too as I'm a native C programmer and the Visual C++ takes some getting used to.
Thanks,
Robert
|
|
|
|
|
Maybe Ive got it wrong what exactely you're looking for, but I've used http://www.flounder.com/logctl.htm[^]before - he has posted it here to CP as well...
this'll help with the logging part ....
(there are other logging articles on cp as well)
hth
|
|
|
|
|
Garth,
Thanks, this is perfect! What is CP though? I would like to explore other solutions too.
Robert
|
|
|
|
|
|
I have to convert some integers into hexadecimal string format and then convert them back in later process, there's no problem until I encountered negative integers then things messed up:
int nOffset = -2600;
TCHAR sz[32] = _T("");
_stprintf(sz, _T("%X"), nOffset);
nOffset = _tcstol(sz, NULL, 16); And the value of nOffset becomes 2147483647, not -2600 as I expected.
How can I solve this problem? Thanks.
|
|
|
|
|
use _tcstoul() instead of _tcstol()
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Thank you man! I can't believe how lame I was...
|
|
|
|
|
I think the format converts it to unsigned long by default anyways. The large number is just how a negative number is expressed. It is (0xFFFFFFFF - 2600). If you want it to act as needed you must do it yourself:
_stprintf(sz, _T("%s%X"), (nOffset < 0 ? _T("-") : "", <br />
(nOffset < 0 ? -nOffset : nOffset);
J.
----------------------------
|
|
|
|
|
Thank you for the reply, but I have to make sure that the result string does not exceed 8 characters long, so the "-" cannot be added. I used PJ Arends's method and it worked perfectly. Thanks again.
|
|
|
|
|
I need this in c++ console.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Searching where ? The command line ? Text input ? A file ? The cracks in the floor ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I want to open a file, text, and look for a specific character, ' ; '. Also I would like to see how many lines were before the actual character. Please help me in any of the above problems.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Sounds like you are writing a C compiler...
Maxwell Chen
|
|
|
|
|
no not really, im doing a real AI program that learns tic tac toe from nothing, please help me. confused:
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Read my article on extending iostreams to write a custom stream. I'd impliment a stream that derives from fstream, and add behaviour to count newlines and stop on a ;
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
This may be of some help.
#include <stdio.h>
#include <string.h>
int main ()
{
char str[] = "This is a sample string";
char key[] = "aeiou";
char * pch;
printf ("Vowels in '%s': ",str);
pch = strpbrk (str, key);
while (pch != NULL)
{
printf ("%c " , *pch);
pch = strpbrk (pch+1,key);
}
printf ("\n");
return 0;
}
Output:
Vowels in 'This is a sample string': i i a a e i
Thank You
Bo Hunter
|
|
|
|
|
Hey, cool. A C programmer. Is there much work in C still ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
How would you go about developing an algorithm that would for
example takes a list of songs and shuffles them and uses each
song once and only once? Also what if you wanted to me aware
of the order so that you could have a previous function that
would give you the previous song in the list back to the
beginning?
Thanks,
Steve
|
|
|
|
|
This is not optimal, but it can serve your purposes:- Let
n be the number of songs to shuffle.
- Define a map of
int s to string s.
- For every song in the list:
- Generate a random number
r between 0 and n-1 , check if the r -th entry of the map is empty, repeat until you find an empty slot.
- Insert the song into the map using index
r
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for your responses. I will look into Mr. Dunn's comment as well.
Steve
|
|
|
|
|
I recommend you rather follow Mr Dunn's comment, it is a much cleaner solution. Somehow I forgot about std::random_shuffle .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
I recommend you rather follow Mr Dunn's comment, it is a much cleaner solution. Somehow I forgot about std::random_shuffle.
Muchas gracias tio.
Steve
|
|
|
|
|