473,323 Members | 1,574 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,323 software developers and data experts.

Program with the spaces in C

Hi,
I started to program a few months ago, but now i have a really dummy problem that i cant solve...

So my program reads this : "asdasdas asdasdas asdasd"
like 3 chars insted of one...

Can anyone tell me how to put the program reading spaces like just one char?

thkz
Dec 23 '07 #1
3 1105
oler1s
671 Expert 512MB
So my program reads this : "asdasdas asdasdas asdasd"
That is a string.
like 3 chars insted of one...
Which means what? I don't understand what you have described. Redescribe the problem. Maybe you do not know the terminology. In that case, tell me your observations only.

Can anyone tell me how to put the program reading spaces like just one char?
Cannot understand the question. I'll ignore it and wait for you to redescribe the problem.
Dec 23 '07 #2
sorry, my english is very bad xDDD

Well, the problem is:
I have a do while, to "restart" the question when the insert value is not one that its recognize to the program, like

Menu -> if u want to continue write 1
If u want to do something else write 2

The problem is when the user writes something with spaces, like "3 1312 12312"
the program is scaning 3, 1312, 12312 like 3 diferent chars, and he is comebacking to the menu 3 times insted of one.

Basecally i want the program to read 3 1312 12312 as one single char and not 3.

Ex;

Program:
Menu -> if u want to continue write 1
If u want to do something else write 2

User writes 3 1312 12312

Program:

Menu -> if u want to continue write 1
If u want to do something else write 2

Menu -> if u want to continue write 1
If u want to do something else write 2

Menu -> if u want to continue write 1
If u want to do something else write 2

_____

I want the program when the user writes something with spaces like "3 1312 12312" or "aasd 213 asda" to return only one time the menu.

I hope that i have been clear enough

thkz for the help
Dec 24 '07 #3
primeSo
35
First of all, you must make it very clear between "string" and "character" in C.
This two have distinctive differences.

For example: "qwe qwe qwe" is a string with 3 "WORDS". Each word consists of 3 CHARACTERS. These 3 WORDS form a STRING in C. And the words is deliminated by a SPACE. THIS IS THE FUNDAMENTAL KNOWLEDGE.

The problem you mentioned is a common buffering bug in C. I suggested you to do some reading regarding input/output(I/O) in C. You will know how to read in a space as well by studying the topic i mentioned.

Hope this will help : )
Dec 24 '07 #4

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

Similar topics

4
by: Josh | last post by:
Howdy i am newb somewhat to programing and i was just for fun trying to compile a program that asks the user for an odd int less than 22 and then returns this ***************** ******* *********...
6
by: shoo | last post by:
Any one know how to do this? thank Write a simple text-formatting program that produces neatly printed output from input text containing embedded command lines that determine how to format the...
9
by: Swaroop C H | last post by:
Hi, Is there a way to set the program name in Python, similar to $0 in Perl? >From `man perlvar`: $0 Contains the name of the program being executed. On some oper- ating systems...
6
by: shoo | last post by:
Any one know how to do this? thank Write a simple text-formatting program that produces neatly printed output from input text containing embedded command lines that determine how to format the...
34
by: Tom | last post by:
I'd greatly appreciate advice and code snippets on how to create a ram disk within a C/C++ program. I also need to be able to determine the free space. Thanks in advance for any help.
7
by: Sheikko | last post by:
Hi all, i have an application and i wan to call another program into it, like notepad, so when i minimize the notepad, or maximize, it must rest in my application. thank you
7
by: montyphyton | last post by:
Some recent posts about Python programming style got me thinking. Since we have the PEP 8 which gives some guidelines about the style to be used, do we have any program that can check for...
14
by: wshaer | last post by:
Hi all, I have an assignment and I need some help with it. This is the assignment // Research reports are often required to conform to a given standard such as APA or MLA. These standards...
14
by: hall.jeff | last post by:
I wrote the following simple program to loop through our help files and fix some errors (in case you can't see the subtle RE search that's happening, we're replacing spaces in bookmarks with _'s) ...
0
amitpatel66
by: amitpatel66 | last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations: Concurrent programs can be executed...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.