LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-14-2018, 09:59 PM   #1
shlomo.hovir
Member
 
Registered: Oct 2018
Posts: 66

Rep: Reputation: Disabled
why people use hexadecimal with printf statament in many languages including shell and c


why people use hexadecimal with printf statament in many languages including shell and c
 
Old 12-14-2018, 11:39 PM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Please provide three (or more) examples so that we could discuss your question.
 
1 members found this post helpful.
Old 12-14-2018, 11:56 PM   #3
shlomo.hovir
Member
 
Registered: Oct 2018
Posts: 66

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
Please provide three (or more) examples so that we could discuss your question.
Printed "0x45"

Idk hex that's an assumed hex code
 
Old 12-15-2018, 12:39 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
This command doesn't work for me:
Code:
$ Printed "0x45" 
bash: Printed: command not found
Also it has nothing to do with 'printf'. So I couldn't decrement the counter, it is still 'three':
Please provide three (or more) examples so that we could discuss your question.

Last edited by NevemTeve; 12-15-2018 at 12:41 AM.
 
1 members found this post helpful.
Old 12-15-2018, 12:52 AM   #5
shlomo.hovir
Member
 
Registered: Oct 2018
Posts: 66

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
This command doesn't work for me:
Code:
$ Printed "0x45" 
bash: Printed: command not found
Also it has nothing to do with 'printf'. So I couldn't decrement the counter, it is still 'three':
Please provide three (or more) examples so that we could discuss your question.
Sorry printf
 
Old 12-15-2018, 01:38 AM   #6
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Hexadecimal numerals are widely used by computer system designers and programmers, as they provide a more human-friendly representation of binary-coded values.
https://en.wikipedia.org/wiki/Hexadecimal
 
2 members found this post helpful.
Old 12-15-2018, 02:10 AM   #7
Mechanikx
Member
 
Registered: Jul 2018
Distribution: Slackware
Posts: 351

Rep: Reputation: 258Reputation: 258Reputation: 258
@shlomo.hovir your question is so general, that without better examples, or further elaboration, the answer to your question is "because they want to".

EDIT: There was a long delay in posting this, and I wasn't aware that Hydrurga had replied yet.

Last edited by Mechanikx; 12-15-2018 at 02:50 AM.
 
1 members found this post helpful.
Old 12-15-2018, 02:23 PM   #8
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 900

Rep: Reputation: 290Reputation: 290Reputation: 290
As said previously, it's hard to answer that question without any examples...
Out of the blue, I would list at least 2 potential reasons:
  • make sure the shell doesn't interpret the character (echo -e "This is a \x22test\x22")
  • represent keyboard missing characters easily ("0xAE" for registered trademark...)
 
Old 12-15-2018, 04:22 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
shlomo.hovir, you have been asked for specific examples so that others can understand your question...

Quote:
Originally Posted by NevemTeve View Post
Please provide three (or more) examples so that we could discuss your question.
And again...
Quote:
Originally Posted by NevemTeve View Post
...it has nothing to do with 'printf'. So I couldn't decrement the counter, it is still 'three':
Please provide three (or more) examples so that we could discuss your question.
Simply saying...
Quote:
Originally Posted by shlomo.hovir View Post
Sorry printf
... is not only not helpful, but may be taken as dismissive and taunting by other members.

Everyone here volunteers their time and talents, and are willing to put forth much effort to help with your questions. But it is required that you also respect their efforts and put forth your own effort to ask well formed questions and respond to their requests for clarification.

As you have been asked repeatedly, please review the Site FAQ for guidance in posting your questions and general forum usage. If you cannot or will not put forth the effort to participate in this forum in a manner respectful of other members and within the very permissive guidelines referred, you will be asked to seek help elsewhere.

Please consider this as a warning that you need to make that effort now.

Last edited by astrogeek; 12-15-2018 at 04:24 PM.
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How many programming languages is too many for one project? LXer Syndicated Linux News 0 11-26-2018 01:35 PM
How to read local languages (Telugu, Malayalam, Tamil, Devanagari (including Marathi) allu john sudhakar Linux - News 1 11-25-2010 05:34 AM
[SOLVED] printf $"Hello $var\n" vs. printf "Hello $var\n" -- not a typo. What is it? GrapefruiTgirl Programming 2 10-21-2010 08:21 AM
languages of linux: which languages can be choosen in suse and red-hat distributions? Klaus Schnorr Linux - Software 3 09-10-2005 02:19 AM
How is 'man 3 printf' different from 'man printf' ?? purpleburple Linux - General 3 09-23-2002 12:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration