|
Thanks for the link!! I just stopped tussling with the issue. Implementing a sensor now
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
Hi all,
I'm struggling with the following:
I have these two pointer:
<code>char* username = "value1";
char* servername = "value2";</code>
And these other two pointers:
<code>
unsigned short* uni_domain;
unsigned short* uni_username;
</code>
And I'm trying to assign the fisrt two pointer values to the second two pointer, I tried the following:
<code>
uni_domain = (LPWSTR)username;
uni_username = (LPWSTR)servername;
</code>
But the function : <code>NetUserGetInfo</code> is not equal to <code>NERR_Success</code>, which indicates its not valid.
When I do this it works:
<code>
uni_domain = L"value1";
uni_username = L"value2";
</code>
But I'm sending values to a function, and the above will not help my cause.
Can anyone help me?
Only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
You can't typcast a unicode string to an ansi string, you must use the MultiByteToWideChar() function, or the W2A macro. I think you would be better off reading about the TCHAR strings and the _T() macro, it's a lot easier to deal with.
|
|
|
|
|
hi everyone,
i have to know that the given CString variable contains numeric value , eg
CString str = "1233.23" , is having a numeric value, i want to trap that.
but problem is that i dont know how to determine that the string variable contain the numeric value. ( not like str ="123hh" or str ="hh1234")
Can any body help me
|
|
|
|
|
iterate through each character. it must contain only 0~9 , + , - , .
|
|
|
|
|
If your strings will always start with a numeric value you can use the atoi() function, but from your example I guess not. You would have to go through each character and text the value.
|
|
|
|
|
How to get your string?from a editbox...?its for only number or string?
|
|
|
|
|
Use isdigit() .
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
-3.2 is a valid numeric number ; BTW, - and . characters won't be validate by isdigit() though
|
|
|
|
|
True. Those two characters would need to be handled individually. However, a string such as "3.2-" would not be considered a valid number even though it has only . (dot), - (dash), and digits. sscanf() could be used, depending on the tolerances.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You can use the isalpha(int c) to verify each character or you string. If any call to this function returns 1, your string is not composed only by numbers.
|
|
|
|
|
isalpha('}'); will return false, however, the string is not composed only by numbers...
your method has serious lacks
|
|
|
|
|
I just want to practice class using, but met this problem:
fatal error C1004: unexpected end of file found.Could anyone lend me a help,thank you!
Code:
// prac.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "iostream"
using namespace std;
class polygon{
protected: int width, height;
public: polygon(int,int);
virtual int area ()
{ return (0); }
};
polygon::polygon(int a,int b)
{
width=a;
height=b;
}
class triangle: public polygon{
public: int area(){
return(width * height/2);
};
class quadrangle:public polygon{
public: int area()
{return (width * height);}
};
void main(int argc, char* argv[])
{
quadrangle ax(10,5);
triangle bx(10,5);
cout << "ax area: " << ax.area() << endl;
cout << "bx area: " << bx.area() << endl;
}
|
|
|
|
|
this is unmanaged C++ ask the correct forum.
|
|
|
|
|
sorry, what does that mean? how to solve it?
|
|
|
|
|
|
toxcct wrote: ask the correct forum[^]...
Hey Tox,
The thread has been moved to the unmanaged C++ forum.
|
|
|
|
|
it wasn't when i wrote it
but yup, you're right
|
|
|
|
|
toxcct wrote: it wasn't when i wrote it
I know. In general, unless a thread changes mid-way into a managed question (or an unmanaged question) in the wrong forum, it's best to leave it for a day or two (without replying) so someone can move it to the right forum
Strange though that people can't even decide the correct forum to post their questions. They see the word 'C++' and bang - make their post!
|
|
|
|
|
i think also many people don't even know what managed C++ is (and whant managed actually means !!), and when one has a general question about C++, the fact that the main C++ forum contains "visual" in its name might tell them, "it's certainly not what i want to ask about, so, i'll go to the other C++ forum"...
|
|
|
|
|
It looks that the definition of class triangle has one "}" missing.
Best,
Jun
|
|
|
|
|
Hi,
This happens when you skip somewhere closing bracket "}".
Double check your source code.
|
|
|
|
|
1111-----1
1 11------
1111----1-
--------111
--------111
--------111
hi, as the previous question may not so easy to see, so i post the question out again here..
this is just only a example, and using C++ to solve plenty of these similiar example.
In this problem, you can ignore all the - simbol as they stand for the space only, and you can see that:
the hole formed inside many 1 consider call void element=V; here v = 1
two 1 which is quite far away from others is call exceptional element=E,here E = 2;
let the total number of 1 =A; here A = 22
i need to use the C++ to calculate the below result
S = (A-E)/(A+V)
for example this case s = (22-2)/(21+1)=0.91
So how to write a C++ program, to search for the void element V; the exception element E as well as the total number of 1 A and calculate the result??
i am so eager to know the knowledge about this, may anyone give me a hand???
Your great help will be appreciated!!, thank so much.
please send to my email sinbearzc@hotmail.com if you can give me a help, thank..
|
|
|
|
|
Your question is not clear at all. What are these spaces and '1' ? Is that data contained in a file that you need to read ? Or what ?
When describing a problem, try to imagine people reading you. What you describe is just too abstract for us to understand (at least, for me to understand )
sinbear wrote: please send to my email sinbearzc@hotmail.com if you can give me a help, thank..
No way, this is a forum so if we have an answer, we'll post on the forum.
|
|
|
|
|
sinbear wrote: the hole formed inside many 1 consider call void element=V; here v = 1
Here you mean this line 1 11------ yes? Did you make a mistake? Should the line be 1-11------ ? You say a hole inside many 1's. How many? In your example there are 3 1's.
sinbear wrote: two 1 which is quite far away from others is call exceptional element=E,here E = 2;
quite far does not explain enough. Do you mean when there is more than 1 space between the 1's?
Your example shows multiple lines. How exactly do you read the numbers? Are they binary or ASCII, does the file also contain lines (with a CLLF at the end of each line) or is it a continuous stream?
Before anybody can help you, you must answer all of my questions.
|
|
|
|