|
What I meant was:
if (nUserCode==1)... use the ">" operator else
if (nUserCode==2)... use the "<" operator
is there any way to substitute the relational operator with a variable?
e.g.
(num1 Variable num2)
when nUserCode==1, the above becomes (num1 > num2). Similarly,
when nUserCode==2, the above becomes (num1 < num2).
|
|
|
|
|
you can do that with macros, but that's not very beautiful.
TOXCCT >>> GEII power
|
|
|
|
|
A funny way!!!
for User 2 just swap the pairs->(num1 with num2),...
Kamyar Souri
Booria CAD/CAM Systems
www.booria.com
|
|
|
|
|
Hi all,
this is not a C++ question, but i think i can get answer here.
i want to register a domain and need around 200M space for a small business.
my Q is: which company offers the service with good price and support?
i have used google to find few companies, but none of them answered any my enquiries.
if you use or know this sort of companies, please give me a link.
thanks
includeh10
|
|
|
|
|
First off:
Register your domain with GoDaddy...
Second what kind of enquiries did you need answers too? I find I contribute more to my hosting providers message forums then they're tech support combined However thats not to say they aren't a decent company...i've never needed their help really, but they offer a public forum none the less...and fairly quick (couple hours usually) email repsonse for immediate answers...and I imagine they have a phone # but probably takes forever to get a hold of someone
They offer decent hosting space/php/mysql which justifies all my online business needs (for the time being). Bandwidth is through the roof(25 GB or something) and my web site can handle some decent traffic (for all my purposes so far) I would assume 5-15 visitors at a time...a few seconds apart anyways...it's a shared host so I don't get that much free time
Truth be told, in my experience all hosting companies are the same....they really suck...and few offer above and beyond what they have too...they're not run my computer geeks who love technology...they're run by business men who noticed a niche market that needed filling...and now of course there are too many...which casues serious competition...which is actually a bad thing...
I have known people who rent the space of a dedicated host off a major provider and turn around and sell that service back to the public for dirt cheap and never make it anywhere because they charged to little to stay "competitive"
What happens when your hosting provider goes out of business??? Depends on who your hosting company hosted with...if they're a large provider and offer daily backups and the whole nine yards...they're probably keep a recent back up of all your data for about a week (in my experiences anyways) but many hosting companies pull the plug on your files database, etc when te funds run out and then it's "sa la vie"!!!
So this is what typically look for...
A hosting company which offers all basics that your business will need...
FTP
Sufficient bandwidth
disk space
MySQL/PHP (latest stable versions)
Flexible backend control panel (myPhpAdmin is ok, but not the best)
If they are willing to dish out chunk of change and purchase a quality CPanel you can probably bet they're in business for the long haul...and not some quick startup bound for failure.
1) If you don't get a response with a couplt hours...they aren't worth it (espcially by email)
2) Visit their web site a few times through out the day...if it's slow to load (a couple times)...thats not saying much for a hosting company
3) If they offer web design services (I shouldn't be advertising to competition, but...) and graphics etc...their probably a smaller firm, but are highly dedicated to what they do...so look for these guys...only...don't sign up for more then 3 motnhs incase they suck...after you've been with them for a year or so and your happy then save the 80 bux aa year or whatever a signup for a 12 month term
p.s-This should have probably been posted in the lounge or web dev forum
Cheers
How do I print my voice mail?
|
|
|
|
|
Hi Hockey,
thank for your long suggestion
cheers
includeh10
|
|
|
|
|
how can i erase the quotation marks in a CString?
ie.
strTmp.Replace(""", ""); does not work
how can i get around this?
|
|
|
|
|
|
that didn't work
no typos in the original post.
strTmp contains "example" with the quotation marks included in the CString.
i've even tried:
<br />
TCHAR chOld='"';<br />
TCHAR chNew=' ';<br />
strTmp.Replace(chOld, chNew);<br />
still no success.
anymore ideas?
my backup work-around is:
<br />
strTmp=strTmp.Mid(1, strTmp.GetLength()-2);<br />
but this is so dodge and ugly
|
|
|
|
|
#include<iostream>
#include<vector>
#include<string>
using namespace std;
void main()
{string str;
vector<string> yourstring(1);
//string filter( "\",.;:!?)(\\/" );
cin>>str;
yourstring.push_back(str);
vector<string>::iterator iter= yourstring.begin();
vector<string>::iterator iter_end=yourstring.end();
while(iter!=iter_end) {
string::size_type pos = 0;
while (( pos = (*iter).find_first_of( '"', pos ))//filter
!= string::npos )
(*iter).erase(pos,1);
cout<<*iter<<' ';
iter++;
}
}
|
|
|
|
|
Although it sounds quite silly, I havent been able to use the math constants defined in math.h such as M_PI etc.
Can anyone help me with this?
|
|
|
|
|
The simplest way is to define one yourself. For the pi number,
pi = 3.1415926535897932384626433832795......
Maxwell Chen
|
|
|
|
|
I looked the file Math.h but there was not any Costand named M_PI.
also I could not find it on MSDN!
are you sure there is M_PI in any header file?
Kamyar Souri
Software Manager
Booria CAD/CAM Systems
www.booria.com
|
|
|
|
|
i think it is a linux/unix def. everytime i've seen this define it was a unix software.
Don't try it, just do it!
|
|
|
|
|
okay i think i will define my own constant rather that searching for a way to use the constant in the header file. previously i had also used it only on an unix system
thanks for the help
|
|
|
|
|
i am developing a class of muliti_precision integers in c++. i have read in some book that on processors such as the Intel Pentium family which offer an "add with carry" intruction. can someone tell me how to write the instruction in c or c++?
thanks.
|
|
|
|
|
Use this code in your c++ code:
_asm {
mov ax,250
adc ax,10
....
}
|
|
|
|
|
thanks. i will give it a try.
|
|
|
|
|
Ok I have no idea what I am doing wrong here:
#include <windows.h>
void main()
{
const char* buffer = "test";
DWORD byte;
HANDLE hFile = CreateFile("C:\\testing.txt", GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
WriteFile(hFile, buffer, NULL,&byte, 0);
CloseHandle(hFile);
}
I am trying to create a file with text like "test". But it will not seem to write the text. It creates the file, but it won't write test.
-Ryan M.
|
|
|
|
|
Look at the parameters to WriteFile() , specifically the 3rd one. It's nNumberOfBytesToWrite . You're passing NULL , which is defined as 0, so you're saying write zero bytes, which is exactly what happens.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
ok i got it. thanks. I am an idiot for using NULL. I am still learning C++. I know vb much better
void main()
{
const char* buffer = "test";
DWORD byte;
HANDLE hFile = CreateFile("C:\\testin.txt", GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
WriteFile(hFile, buffer, 10,&byte, 0);
CloseHandle(hFile);
}
-Ryan M.
|
|
|
|
|
You're still not passing the right number. Your source buffer is a string, which is 5 bytes long (4 letters plus the terminating 0). You're saying write 10 bytes, which makes WriteFile() read off the end of your string. This may crash, or if not it's writing random bytes to the file. Here's the preferred way:
BOOL bSuccess = WriteFile ( hFile, buffer, strlen(buffer), &byte, NULL ); Notice I'm checking the return value too
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
thank you so much! I will remember that next time
-Ryan M.
|
|
|
|
|
Ryan McDermott wrote:
I am still learning C++. I know vb much better
Never too late to do the right thing
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Ryan
1) I'd be a bit worried about the result if you used '10' as the size of the string as shown in your code ... you could crash the program, since you appear to be writing more characters than you have in the buffer ..
2) I'd use "test\0" to init the buffer and
3) strlen(buffer) as the 3rd argument for the WriteFile
'G'
|
|
|
|