473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how can i use sscanf to read in input from the command line

Is there a way I can use sscanf to read in input from the command line??? I would have just used scanf but I want to convert the integers to octal and then logically shift the result. Any reply at all would be appreciated
Dec 1 '11 #1
4 3110
weaknessforcats
9,208 Expert Mod 8TB
You wouldn't use scanf on the command line.

Learn how to use command line arguments.
Dec 1 '11 #2
johny10151981
1,059 1GB
you would read an integer then convert it to octal(i can assume it would be a character array) and then shift logically,

does not make sense. help us out, to logically shifting why need to convert it to octal?

if you want to convert a integer to octal then use sprintf function

example:
Expand|Select|Wrap|Line Numbers
  1. char a[8];//just choosing 8 no reason why 8
  2. int x=1000;
  3. sprintf(a,"%o",x); //it would create the octal output and store it in a
  4.  
Dec 2 '11 #3
lspxy
12
fscanf() may do what you want.
Dec 7 '11 #4
donbock
2,426 Expert 2GB
Each command line argument is a separate string, so you would have to run sscanf on each one.
Dec 8 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Robert | last post by:
I am using the php4-cgi Debian package which is based on PHP 4.3.4. I have problems when running php4 on the command line. If I say something like $ php4 index.cgi a number of variables...
7
by: Dawn Minnis | last post by:
hey guys i have char *argv to receive command line arguements. I can get characters out no problem I can get integers parsed out no problem But how do I get double values. eg if my program...
5
by: Tarun Mitra | last post by:
I have not been able pass the parameter with a space in an hyperlink on a ..aspx page something like <asp:HyperLink NavigateUrl="http://localhost/syskiosk/test.exe John" id="hlEditDetails"...
0
by: floele | last post by:
Hi. I try to create a small program to handle the FLAC <http://flac.sourceforge.net/> (commandline) encoder or decoder and intend to read its command line output during the process like that: ...
1
by: Frank Rizzo | last post by:
I am writing a little add-in that needs to read the Command Line Arguments for the project as defined in the Project Properties\Configuration Properties\Debugging\Command Line Arguments. How do...
34
by: Roman Mashak | last post by:
Hello, All! I'm implementing simple CLI (flat model, no tree-style menu etc.). Command line looks like this: <command> <param1> <param2> ... <paramN> (where N=1..4) And idea is pretty simple: ...
1
by: Jim | last post by:
Hello, I'm trying to use subprocess to drive a Perl script. I'm having some trouble getting it to spot the command line arguments. Basically, if I call subprocess(args).wait() where args has a...
4
by: Keith Hughitt | last post by:
Hi all, I am using someone else's script which expects input in the form of: ./script.py <arg1arg2 I was wondering if the angle-brackets here have a special meaning? It seems like they...
4
by: lilyumestar | last post by:
I have project I have to do for class. We have to write 4 different .java files. Project2.java HouseGUI.java House.java HouseSorting.java I already finish House.java and I need to work on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.