|
Hai friends,
In my small application iam retrieving the links stored in the IE's favorites folder and write to .doc file. i want to set hyperlink to each of them. Please help me.
Regards,
DJ
|
|
|
|
|
use link label. Did you use it.
|
|
|
|
|
i dont know how to use it..
|
|
|
|
|
|
I can write hex numbers as 0x which range from 0x0 to 0xF
How can I write octa numbers which range from 0 to 7 (Adding 1 to 7 should result 10)
I could do this in C.
Sandeep Bhutani
|
|
|
|
|
Octal number must begin with 0.
For example, 017 is a value 15.
«_Superman_»
|
|
|
|
|
This did not work. I tried int i=010 which should be equal to 8 but was 10.
I also tested in Debug window but 0 prefix has no effect
Sandeep Bhutani
|
|
|
|
|
Sorry, I gave you the C/C++ solution.
In C# you can use Convert.ToInt32(10.ToString(), 8)
Here 10 is the octal number and 8 represents the base (Octal).
«_Superman_»
|
|
|
|
|
Ew, but yeah it may come to that. There's still gotta be a better way.
|
|
|
|
|
It seems that the word "octal" doesn't appear anywhere in the C# spec.
|
|
|
|
|
there are no "binary" or "hex" leywords either, but that doesn't stop us from using whatever we want as a number base.
|
|
|
|
|
As a matter of fact, I use beer as number base.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
That won't cut it. Nobody would trust you dealing with beer-based numbers.
The way I know you, you would soon prove infinity does not exist.
|
|
|
|
|
Actually, I'm trying to reach infinity, but......... hic! ........... another one, plz plz!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Absolutely, great for bubble sorts without the expense that champagne incurs or the sugary-sweetness of cola.
|
|
|
|
|
No, but the words appear in the spec, as in:
binary-operator-declarator:
type operator overloadable-binary-operator ( type identifier , type identifier )
decimal-integer-literal:
decimal-digits integer-type-suffixopt
hexadecimal-integer-literal:
0x hex-digits integer-type-suffixopt
0X hex-digits integer-type-suffixopt
Not so for octal.
|
|
|
|
|
Actually, binary operators is a misnomer IMO; it really are bit-level operators meaning all the bits have independent meaning and behavior, there is no link to base 2 there.
I would not mind C# supporting binary and octal literals, hence also a convention to indicate those bases; and support for it in TryParse and ToString.
However I would very rarely use it; octal is thing of the past; some instruction sets got described in octal (e.g. PDP8 and PDP11), which looked OK at the time mainly because they had 8 registers so it was a signle digit that chose the register).
Binary notation tends to lack compactness; with a comma every 4 bits, an Int32 would take 39 characters.
|
|
|
|
|
Luc Pattyn wrote: binary operators
... operate on two operands. You know that.
Luc Pattyn wrote: supporting binary and octal literals
The C way of indicating octal literals is problematic. C# leaves it out, but that means that code copied from C will be broken with no alert.
I expect 0o10 would be better, with a warning if someone uses a capital O rather than a lowercase o , as with the l to indicate long.
Luc Pattyn wrote: octal is thing of the past
Yes, the only time I need octal is for OpenVMS UICs, and I still do see why they have to be done in octal.
Luc Pattyn wrote: Binary notation tends to lack compactness
Yeah, gimme Base-64 any day!
|
|
|
|
|
PIEBALDconsult wrote: binary operators
... operate on two operands. You know that.
Yeah, I used to known that (seems like the flu is not really helping me);
"binary operators" too is unrelated to base 2.
and bit-wise operators it the right term for some of the (mostly binary) operators
|
|
|
|
|
C# does not have octal literals(unfortunately). But we do have it in VB. So you have two ways:
1. Create a VB dll and refer it C#.
2. Get the data in string and write your own method to convert it to Octal.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
how bout:
public int Oct(int dec)
{
return ((dec / 8) * 10) + (dec % 8);
}
then
int octal = Oct(8);//should result in 10
|
|
|
|
|
The reason:
- We are dealing with number representaion in a given base, hence the function should return a string, not an integer.
- What if the input is
64 instead of 8 ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: should return a string
I disagree. Given a binary representation of 10-base10 [00001010], I want to get a binary representation of 10-base8 [00001000].
I'd rather not have to convert to string and back to do that, but I see no other way currently. And it may prove to be more efficient that way anyway.
Edit:
Or more clearly; in C, the statement int x = 010 ; results in a variable that contains the value eight, but in C# the result is the value ten.
It is desirable, in some cases, for int x = Oct ( 010 ) ; (or some such syntax) in C# to produce the desired value of eight, hopefully at compile-time as is the case in C (and apparently in VB.net).
modified on Friday, January 23, 2009 3:52 PM
|
|
|
|
|
You are talking about literals [^] (and you would like octal ones).
I still consider his proposed function conceptually (and technically) wrong.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: You are talking about literals
Ah, you're catching on.
CPallini wrote: conceptually (and technically) wrong
Oh, absolutely, but
public static int
Oct
(
int Value
)
{
return ( System.Convert.ToInt32 ( Value.ToString() , 8 ) ) ;
}
just seems dirty (but not as dirty as resorting to VB).
|
|
|
|