|
I think you got it wrong, char const * x and const char *x are the same and prevent you from changing the contents. For making the pointer itself const, you need to use char * const x.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
-c wrote:
(1)is 'int* x' same as 'int *x'
it works the same, but some people prefer one over the other to remind them it is a pointer to int, not int pointer.
-c wrote:
(2)'char const* x' same as ‘const char *x’
char const * x;//this is a constant pointer to a char type
const char * x;//this is a pointer to a constant char type
|
|
|
|
|
thank you guys....
one more thing..
is 'char const*' same as 'char *const'???
Vendy
|
|
|
|
|
yes. const is only an identifier, but most use it before the type.
you could verify it by yourself (and you will have too because even if you're new to VC++, this is not a "primary school forum") using sizeof() ...
another thing :
read this[^]
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
read this[^]
Bad link, perhaps?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
(1) int* x and int *x mean the same thing.
(2) char const* x and const char *x do not mean the same thing.
char const* x may be read as 'x is a constant pointer to char'. In this case, the pointer is constant, not the character data it points to.
const char *x may be read as 'x is a pointer to characters that are constant.' For this one, the character data is constant.
Software Zen: delete this;
|
|
|
|
|
char const* x and const char *x are the same thing, and they mean "x is a pointer to characters that are constant.'".
"char * const x" means "x is a constant pointer to char"
|
|
|
|
|
-c wrote:
(2)'char const* x' same as ‘const char *x’
See here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
For almost a year already I've been unable to do incremental builds. 4 out of 5 times I try it I get an "Internal Error during pass 2" message, and I'm forced to rebuild. Neither starting a new project, reinstalling Visual Studio .NET 2002 nor patching it seems to solve the problem. Is there anything else I can do?
|
|
|
|
|
Hi-- I've been banging my head trying to solve this problem. Of course I'm a self trained pseudo programmer who just started to use STL. I have a huge file with 10 million entries that are paired, say 1 , 8 ; 1 , 5; 1 , 3; 2 , 0; 2 , 4; 3 , 0; 3 , 8; etc... They are stored as a two dimensional array of 10 million rows and two columns... you get the idea of the data. I need to find the records in the file that have one and only one of the tags in the first entry of the pair and put the second in another vector file in the order found. For example, if I need records with the tag 2, I'll create a vector with 0 and 4. I suppose I need to use a multimap, but do not know how to read the file and then store the results in a vector. Right now I have this simple code:
typedef vector<double> DVECTOR;
DVECTOR FDV;
int tag;
double FD;
int id = 3;
int idp = id + 1;
while(tag != idp)
{
GetData >> tag >> FD;
cout << tag << " " << FD << endl ;
if(tag == id)
FDV.push_back(FD);
}
This does what I want by scaning the file from the begining until it finds the target value and reads all the entries with such value. If the number is close to the first entry, cool it's fast, but if it is near the end it will take a long time (big program repeated many times...). The question is, would the multimap work better and faster to do the same task? If so... how do I do it???
Thank you so much!
Carlos
|
|
|
|
|
Hello! I wanna develop a Http client program! I use three classes (CInternetSession, ChttpConnection, Chttpfile) for doing this! Now I can connect to my web LAN server, send request, and get the response. However, when it finished, I use functions Chttpfile::Close() ChttpConnection::Close(), and CInternetSession::Close() to disconnect to the server. But It doesn't work at all. I also "delete" theses three classes. But the connection still exists until the server disconnect this connection, or I shutdown the program. Is there any solution to disconnect it? Thank you very much!
|
|
|
|
|
I am using cryptlib.lib in my VC7.0 project. I am getting following linker error .. please help to resolve the same
cryptlib.lib(cryptlib.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) private: void __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::_Eos(unsigned int)" (__imp_?_Eos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXI@Z) referenced in function "public: __thiscall CryptoPP::BufferedTransformation::Err::Err(enum CryptoPP::BufferedTransformation::ErrorType,class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > const &)" (??0Err@BufferedTransformation@CryptoPP@@QAE@W4ErrorType@12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
Sandeep Naik
|
|
|
|
|
I'm having trouble integrating MySpell into my application.
I was following the example given by Steve King (Spell Edit) but i keep getting compilation errors. Any suggestions?????????/
|
|
|
|
|
rjnl wrote:
...i keep getting compilation errors
I'm having a hard time seeing those errors. Could you move your monitor a bit closer? Just kidding...
Exactly what (compiler) errors are you getting?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
my problem starts when i include the SpellEdit class into my project.
I get errors like undeclared identifiers
|
|
|
|
|
rjnl wrote:
I get errors like undeclared identifiers
Which is what happens when the compiler encounters a symbol that has not yet been defined.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/c2065.asp
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I'm doing a project where i'm developing a spell checker for our local language. It is to be as an add-in for MS Word. I'm Using MySpell for the spell checking.
I also want to customize the menus so that the names are in our local language.
Is it possible? Where can i get more information? I searched Microsoft's site but most of the things were too complicated for me (I'm just a beginner at the moment).
|
|
|
|
|
I have written a program using Visual C++. Are there any books guide me through creating a skin for my project so you do not see that blue exe file? Also are there any books that could guide me through having a tool bar across the top so the person will have the dropdown screen option of saving, save as, print etc. across the top? If all of this can be done using MFC is there a book that can show me how to accomplish this?
|
|
|
|
|
There are many articles about these topics here on CP.
Don't try it, just do it!
|
|
|
|
|
how would i select a number between 2 numbers? say between 0 and 40, numbers will vary, and keep selecting a unique number till it got them all but none repeated?
Any helps always apprecieated
shotgun
|
|
|
|
|
An easy way would be creating a dynamic-size array, put all the numbers in there, choose one, remove it from the array and then choose another one and so on....
Example:
Number 40-44
Put 40, 41, 42, 43, 44 in an array. The indexes will be 0, 1, 2, 3, 4.
Now get a random number between 0 and 4, fetch the number with that index from the array and remove it then.
The next round you get a random number between 0 and 3, and so on....
Don't try it, just do it!
|
|
|
|
|
...um thanks for the reply, if I'm going to get a random number between 0 and 4, why not just go for the gusto and get a random between 40 - 44, and save the in between and the array?
shotgun
|
|
|
|
|
You need the array to keep track of what numbers you've used. Most random number generators don't guarantee that you'll get a unique sequence. For example, you could get 0,5,12,3,4,5,...
Software Zen: delete this;
|
|
|
|
|
Hi All
This is a basic question but am I correct in saying that the difference between Build, Rebuild and Clean when building is as follows:
Build - Creates a pre-compiled file from scratch recreating all the intermediate files.
Rebuild - Just updates those intermediate files that require changes since last build.
Clean - Deletes all the intermediate files.
Regards
Jeremy
|
|
|
|
|
JSadleir wrote:
Clean - Deletes all the intermediate files. and also the output files!
Rebuild: Same as Clean, but a new Build is launched after it.
Build: Compile all changed files and link.
Build doesn't say anything about pre-compiled header files.
Don't try it, just do it!
|
|
|
|