LinuxQuestions.org
Review your favorite Linux distribution.
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-20-2003, 11:55 PM   #1
zombi3
LQ Newbie
 
Registered: Dec 2003
Distribution: Slackware
Posts: 8

Rep: Reputation: 0
Question Exercise 1-9. Write a program to copy its input to its output, replacing each .......


Quote:
Exercise 1-9. Write a program to copy its input to its output, replacing each string of one or more blanks by a single blank.
If its possible can you guys give me tips on how to solve this questions.
Or if u can please show some sample code and try to example.

Last edited by zombi3; 12-20-2003 at 11:57 PM.
 
Old 12-21-2003, 02:24 AM   #2
Luantum
Member
 
Registered: Oct 2003
Distribution: Slackware 9.1
Posts: 48

Rep: Reputation: 15
So if the input is:
gsdgsdfg

dfsfsfgds



gdsfgsdafgdfg


the output is:
gsdgsdfg

dfsfsfgds

gdsfgsdafgdfg

Is that correct?

It seems like an easy thing to do. Grab stdin and use a for loop on it and put it into stdout.
 
Old 12-21-2003, 02:58 AM   #3
Technoslave
Member
 
Registered: Dec 2003
Location: Northern VA
Posts: 493

Rep: Reputation: 30
See, i understood it as something like this:

Input:

Joe...is a schmoe that......everyone..knows. ( there really are spaces in here . <- is 1 space )

Output:

Joes is a schmoe that everyone knows.

In which case, using sed will fix up that problem easy.
 
Old 12-21-2003, 03:28 AM   #4
zombi3
LQ Newbie
 
Registered: Dec 2003
Distribution: Slackware
Posts: 8

Original Poster
Rep: Reputation: 0
Thnx alot never knew this forum has such smart programming gurus
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
c++ : replacing a char in a string cb951303 Programming 20 02-25-2015 09:18 PM
aplay: pcm_write:1029: write error: Input/output error mimithebrain Linux - Software 2 12-04-2007 12:51 PM
Copy from DVD - Input/Output error nifflerX Linux - General 2 10-12-2005 03:32 PM
how to show input and output of a program on the terminal divin Linux - Software 1 03-25-2005 01:19 AM
grep - finding string and replacing with new ckibler Linux - Newbie 6 08-01-2003 07:25 PM

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

All times are GMT -5. The time now is 07:52 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