LinuxQuestions.org
Visit Jeremy's Blog.
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 02-28-2007, 08:44 AM   #1
WhiskeyTangoFoxtrot
Member
 
Registered: Oct 2005
Location: Windsor, Ontario, Canada
Distribution: Fedora Core 5,4,3 & Ubuntu 6.06, 8.10
Posts: 403
Blog Entries: 1

Rep: Reputation: 30
Question Console inputs, how can i process them ?


All the open source softwares have console inputs but i am unable to understand how they process them. I am designing a program that accepts various inputs ( eg : i- file_name -s server_name etc etc ) but am unsure how to properly write code to process the inputs and save the variables efficiently.

i have used several for loops and crazy if loops too but the code is very messy and it uses more resources than it should. someone mentioned indexing to me, still trying to get that to work though.

any suggestions anyone ?
 
Old 02-28-2007, 09:41 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
What language are you coding in?

There are several libraries to help with this. In perl, I like the Getopt::Long module. Shell scripts can use the getopt command. In C there is the popt library.
 
Old 02-28-2007, 11:14 AM   #3
tread
LQ Newbie
 
Registered: Feb 2007
Posts: 29

Rep: Reputation: 15
If your program is in C, use getopt_long.
See www.advancedlinuxprogramming.com, chapter 2.
 
  


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
How to know the foreground process group ID of another console ?? sreeramabsc Linux - General 0 01-30-2006 01:26 AM
How to pass data to a console program with multiple inputs? juanbobo Programming 3 08-18-2005 06:39 PM
process' and printf's in console jnusa Programming 7 01-12-2005 02:41 AM
Mandrake 9.2's boot process entirely done in console mode before loading in X mode... mishmash Mandriva 6 02-17-2004 09:19 PM
mandrake 9 console and mouse inputs lowly_tech Linux - Hardware 1 02-24-2003 09:10 PM

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

All times are GMT -5. The time now is 11:21 AM.

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