Teen Programmers Unite  
 

 

Return to forum top

need white space character

Posted by matheo917 [send private reply] at August 31, 2001, 08:24:15 PM

can anyone tell me what ASCII character number or any other symbol used by c++ stands for white spaces, i need to add a stopper (delimeter) in my function that stops when it reads in a white space, i am concerned with reading in a text file that will read word after a word, and for example will stop
when it encounteres a space
for example
"programming forum"


for example

ifstream fin("c:\\text.txt");
string str;
getline(fin, str, 'whitespaceneededhere');





Posted by TheTutor [send private reply] at August 31, 2001, 09:50:39 PM

The space character (' ') is 32 decimal (20 hex) in ASCII

Posted by matheo917 [send private reply] at August 31, 2001, 10:17:07 PM

thanx that's what i needed
i appreciate it

Posted by taubz [send private reply] at August 31, 2001, 10:21:11 PM

Only 634 away from the devil!

Posted by gian [send private reply] at September 01, 2001, 12:13:24 AM

2*3*3*37 .... The prime factorisation of the beast!

Posted by drdevil [send private reply] at September 01, 2001, 05:51:33 AM

Correct me if I am wrong, but in C, why not just put ' ', instead of the value, C should convert it to the value for you?

??

Posted by taubz [send private reply] at September 01, 2001, 01:25:02 PM

Speaking of the devil. Hey, Gaz.

- taubz

Posted by drdevil [send private reply] at September 01, 2001, 02:04:57 PM

Hey taubz, how you been doing?
Im going to uni to do BSc in Software Engineering...

Mail me.. gaz@gmx.co.uk

Gaz

Posted by gian [send private reply] at September 01, 2001, 04:07:05 PM

Yes... or if you're really tricky, you can do all sorts of nasty stuff like...

Subtracting the ASCII value of '0' from the character's ASCII value, to find it's real value!

Posted by drdevil [send private reply] at September 01, 2001, 04:17:14 PM

Only if the ascii character is a number though...

Gaz

Posted by Psion [send private reply] at September 01, 2001, 08:12:57 PM

Software Engineering? Let's have Engineers versus (Computer) Scientists wars!

In addition, Mr. Matheo, C has a function isspace() (prototyped in ctype.h) that takes a char code as input and returns whether it is whitespace or not.

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.