|
In terms of C++ and windows OS:
char -> 8 bits
float -> 32 bits (4 bytes)
double -> 64 bits (8 bytes)
int -> 32 bits (4 bytes)
Kuphryn
|
|
|
|
|
I understand that, but if the I wanted to know the size of
char [1024] would it be (8 * 1024)= 8192 bits and 1024 bytes?
steven
|
|
|
|
|
|
johnstonsk wrote:
I know if I have the number of bits on each on then I can divide by 8 to get the number of bytes.
If you know that bits ÷ 8 = bytes, then you must also know that bytes * 8 = bits.
|
|
|
|
|
Well, 8 bits is always a byte.
Generally speaking the number of bytes that a particular type uses can vary depending on the platform and the language. Some languages, like Java, define the size of specific types.
If you want to evaluate the number of bytes something is using then I suggest trying the sizeof[^] operator in C. Do a search on sizeof and you will find references for other languages such as the .NET framework.
--
"The money power of the country will endeavor to prolong its rule by preying upon the prejudices of the people until all wealth is concentrated in a few hands and the Republic destroyed."
-- Abraham Lincoln
|
|
|
|
|
Note that this:
char[3]
can take 32 bits (!) due to alignment.
On a 64 bit computer it should take 64 bits. so:
char[9] would use the space of 128 bits.
if you newed an array it would probably take even more space, due to the fact that the heap has to be managed in some way.
|
|
|
|
|
is it possible to open the audio in and audio out of the sound card at the same time and playback something that is different from the input to line in.
|
|
|
|
|
Yes and no (or... maybe).
Of course you can output audio that's different from what you get from audio in. However, to "playback something that is different from the input [to line in]" seems impossible unless you're willing to bring out the soldering iron.
|
|
|
|
|
Yes, just about every sound device these days support simultaneous record and playback.
There are two things:
1. You might have to record and playback at the same rate. Probably not, but best to play safe.
2. On the mixer control panel, make sure on the output mixer you disable 'Line in' or that will get mixed into the output.
Elaine
The tigress is here
|
|
|
|
|
I linked a file type with my program, such that if you double click on a file in explorer, it opens the file using my program. The only problem is if there's an instance of the program already open I want that instance to open the file rather than starting a new instance. (for example, if you double click a .doc file, you do not want start a new Word session if one is already open. Instead you want the existing word session to open the document).
Anyone have any ideas on the best way to do this?
John
|
|
|
|
|
While not a direct answer to your question, you can start with these two references:
http://www.naughter.com/sinstance.html
http://www.flounder.com/nomultiples.htm
|
|
|
|
|
We use the sinstance evrsion here at work. With a mod to the MMF structure such that if another instance starts up, it can copy the command line across into the object, send a registered message across to the other instance to tell it to open it and then kill itself. Works very well, just need to be careful about access to the MMF object. Need to avoid those race conditions, as you can open multiple docs at once in explorer.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Hi,
I am trying to modify the CListCtrl to match the visual design of the rest of my application. This means I need to change the look and feel of the CListCtrl.
I have successfully subclassed the CHeaderCtrl and made the column headers bitmaps using custom draw instead of that ugly grey button style.
Now I want to change the look of the scrollbars. Does anyone have an example of how to custom draw scrollbars in a CListCtrl? Either change the color, or replace them with bitmaps or anything.
I don't care if I have to owner draw it or custom draw it or use windows hooks. Does anyone have any sample code on how to do this or any insight on how I might go about doing thing?
Thanks in advance!
Greg
|
|
|
|
|
|
Does anyone know how to get the path to the system temp directory? Ive tried using GetTempPath but it returns the path to the currently logged on users temp directory. I need to get the system temp directory.
Thanks for the help,
Kevin
|
|
|
|
|
You are making a distinction between the two but shouldn't be. The fact that both happen to exist on some systems is pure coincidence.
char szPath[MAX_PATH];
if (GetTempPath(szPath, sizeof(szPath)) > 0)
{
if (_access(szPath, 0) == 0)
else
}
|
|
|
|
|
The problem that Im trying to solve is that I have a post-install app that sets various permissions on various directories for a particular user for when a server app (the one this post-install app helps install) runs. This post install app will most likely not be ran as the user that it it setting permissions for (the server user). So what I need to be able to do is get the temp directory, if it exists, for the server user that the server will run as, since the server will need this directory to write some temp files to. Is there a way to do this?
Thanks for your help.
|
|
|
|
|
kevdosh wrote:
So what I need to be able to do is get the temp directory, if it exists, for the server user that the server will run as...
I would suggest you write a little 5-line app (see my previous post), run it as the "server user," and note the result. I suspect it will either be C:\Documents and Settings\administrator or C:\Documents and Settings\Default User.
|
|
|
|
|
How about getting the windows directory and adding "\TEMP" to it (environment variable WINDIR) ?
A little crude but every Windows installation I've seen has this diectory.
Elaine
The tigress is here
|
|
|
|
|
Hi,
I am looking for a word phrase search algorithm in C++. In other words
I want to look for “Hello World” in a txt file or any other word combinations.
Any help would be greatly appreciated.
Ken
"I calculated the odds of this succeeding
versus the odds I was doing something incredibly
stupid...and I went ahead anyway." -Crow T. Robot
|
|
|
|
|
Why don't you look at basic_string::find from C++ Standard Library?
|
|
|
|
|
Nemanja Trifunovic wrote:
Why don't you look at basic_string::find from C++ Standard Library?
Yes that would work for searching a continuous phrase. I forgot to mention that I could specify a search like find “Hello #2 World” in a sentence “Hello there World” where the word World is the second position from Hello.
Thanks,
Ken
"I calculated the odds of this succeeding
versus the odds I was doing something incredibly
stupid...and I went ahead anyway." -Crow T. Robot
|
|
|
|
|
Madmaximus wrote:
Yes that would work for searching a continuous phrase. I forgot to mention that I could specify a search like find “Hello #2 World” in a sentence “Hello there World” where the word World is the second position from Hello.
Try: Regular Expressions[^]
-Nick Parker
|
|
|
|
|
Or, use MS Index server. You can even connect to it via ODBC. Plus, it is probably already on the machine.
|
|
|
|
|
Hi, I need help with this:
I need to change Proxy server settings of Internet Explorer in runtime. I change ProxyServer value in registry
(key: HKEY_CURRENT_USER// Software\\Microsoft\\Windows\\Currentversion\\Inte
rnet Settings ) to the corresponding NEW values.
But next time when I open IE, it is still using OLD ProxyServer settings. But when I open Tools/Internet options/Connection dialog, my NEW proxy server values appear there. When i click OK,
IE start using the NEW values. But I need to change it during runtime, so IE starts to use the new values immediately.
Is there a chance to do that?
Thanx.
|
|
|
|