Questions tagged [octal]

The octal numeral system, or oct for short, is the base-8 numeral system, using the digits 0 to 7. Often used to notate Unix permissions. It has also used to store the on/off state of digital seven-segment displays.

The octal numeral system, or oct for short, is the base-8 numeral system, using the digits 0 to 7.

More on the use of octal in computing.

Related tags

419 questions
8
votes
1 answer

What is the meaning of 0o777 as value of mode of mkdir?

I would like to use mkdir in python. It has a parameter mode, whose default value is '0o777'. I know file mode 0777 in Linux. However I don't know what o between 0 and 777 is. What is it?
mora
  • 2,217
  • 4
  • 22
  • 32
8
votes
3 answers

Error in getOctD(x, offset, len) : invalid octal digit

I try to install packages (pdbDEMO actually and all the dependencies) and I am encountering an issue, that I cannot solve and I haven't found any solution about it. I use the R command : >install.packages("pbdDEMO",…
user2753495
  • 81
  • 1
  • 3
8
votes
3 answers

isHex() and isOcta() functions

I have Two Functions. IsOcta and isHex. Can not seem to make isHex work properly. Issue in isHex() is that it can not omit 'x' notation of the original string x23. Original hex srting can also be D1CE. So adding x and then comparing wont do. Is…
suswato
  • 83
  • 1
  • 6
7
votes
1 answer

Printing Octal characters in java using escape sequences

Please explain the below code public class Example{ public static void main(String[] args) { int i[]={9}; System.out.println("\700"); } } Please don't say me that the octal value should be less than 377. I know it already but…
prathapa reddy
  • 321
  • 1
  • 4
  • 17
7
votes
2 answers

Python2.6 Decimal to Octal

How can i convert decimal to Octal in Python2.6, for 1 to 100000? I wanna get this converted result as .txt too. Can someone help me?
user233935
  • 111
  • 1
  • 1
  • 2
7
votes
2 answers

BigInteger Parse Octal String?

In Java, I could do //Parsing Octal String BigInteger b = new BigInteger("16304103460644701340432043410021040424210140423204",8); Then format it as I pleased b.toString(2); //2 for binary b.toString(10); //10 for decimal b.toString(16); //16 for…
snotyak
  • 3,709
  • 6
  • 35
  • 52
6
votes
1 answer

PHP: fileperms() values and convert these

Here is something i dont understand: A file has the permission 0644 which if i use php´s fileperms() functions returns 16804 as integer if i make a var_dump(). What/where is the relation between the two and how can i convert a, lets say 0755, into…
setcookie
  • 579
  • 1
  • 6
  • 12
6
votes
4 answers

Change '0777' string to 0777 octal LITERALLY

My code is like $perm = "0777"; //this is fetch from the database chmod("myFolder/", $perm); but the value of $perm is not in octal, how can I change the data type of the variable to octal? even an alternative method will do
Xelakz
  • 175
  • 3
  • 11
6
votes
7 answers

Handling numbers with leading zeros in Tcl

I am having trouble in Tcl using numbers with leading zeros. I am parsing some numbers that can have leading zeros, such as "0012", which should be interpreted as the integer "twelve". $ tclsh % set a 8 8 % set b 08 08 % expr $a - 1 7 % expr $b -…
Christopher Bruns
  • 9,160
  • 7
  • 46
  • 61
6
votes
3 answers

Using Python's stat function to efficiently get owner, group and other permissions

Question: How do I efficiently use the stat function to get meaningful file permissions (User, Group and Other). Details: I am querying the file permissions like so: statInfo = os.stat permissions = stat.S_IMODE ( os.stat ( 'fooBar.txt' ).st_mode…
puk
  • 16,318
  • 29
  • 119
  • 199
5
votes
1 answer

How do I make the system print 0x before the hex number & 0 before the octal number?

My teacher says that for the assignment we are not allowed to manually print the 0x before the hex number, we have to make the system do it. Currently my code looks like this: cout << "Hex" << setw(12) << hex << static_cast(letter) << setw(12)…
5
votes
9 answers

Decimal to octal in C

I have just begun teaching myself C out of K.N King's C Programming: A Modern Approach (2ndEdn). I'm enjoying it, but am hoping to post the odd question here for advice if appropriate because unfortunately I don't have a tutor and some bits raise…
aussie_aj
  • 319
  • 4
  • 7
  • 14
5
votes
3 answers

How is it possible that an octal literal can be negative?

Why is n in const int n = -0123; an octal literal? I thought that all octal literals had to start with a 0, and this one doesn't since it starts with a negative. It's a small point I know but It's causing me great confusion!
5
votes
2 answers

What does an extra 0 in front of an int value mean?

Inspiring from a obfuscated piece of code, I have a small question regarding to assign value to an integer: #include #include int main() { int i = 0101; std::cout << i << "\n"; } And the output was 65, and I have no…
roxrook
  • 13,511
  • 40
  • 107
  • 156
5
votes
1 answer

octal string to integer for open(O_CREATE) permissions

How to use an octal string from *argv[] for something like: open("outfile",O_CREAT | O_RDWR,0777); 0777 means permission in octal numbers. My code: int arC = atoi(argv[optind]); printf("argv optind %s after atoi %d\n",argv[optind],arC); int test…
1 2
3
27 28