Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 07-04-2008, 03:38 PM   #1 (permalink)
Right Off the Assembly Line
 
Shikher_neo's Avatar
 
Join Date: Oct 2006
Posts: 47
Default help wid /n


hey, i have some prob wid da /n character.well as u know during output to a file a /n is converted into 2 characters.it increases the size and hense i am having prob in appending data through the for loop.using binary completely deleted all the /n.
please help me
__________________
God Does Not Play Dice
-Albert Einstein
Shikher_neo is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 07-04-2008, 03:59 PM   #2 (permalink)
हॉर्न ओके प्लीज़
 
victor_rambo's Avatar
 
Join Date: Sep 2007
Posts: 1,493
Default Re: help wid /n

I am sure what you need, but if you are speaking about the 'newline' delimiter, then its "\n" and not "/n". You are using forward slash instead of back slash.
__________________
विक्टर रॅंबो - चाणकया प्रभावित व्यक्ति

गीक होना माँगता
victor_rambo is offline  
Old 08-04-2008, 04:11 PM   #3 (permalink)
Apprentice
 
Join Date: Apr 2004
Location: India
Posts: 50
Default Re: help wid /n

Yeah, true. Use \n instead of /n
__________________
Aakash Shah
aakash is offline  
Old 08-04-2008, 04:17 PM   #4 (permalink)
Human Spambot
 
Join Date: Jan 2007
Location: Lat 28.38°N , Longt 77.13°E
Posts: 2,431
Default Re: help wid /n

/n will be equal to two characters. One for '/' and other for 'n'
ThinkFree is offline  
Old 13-04-2008, 05:55 PM   #5 (permalink)
Right Off the Assembly Line
 
Shikher_neo's Avatar
 
Join Date: Oct 2006
Posts: 47
Default Re: help wid \n (also-how 2 display * during input ? )

sorry for the backslash.I actually meant \n.But i know it occupies 2 bytes one for the carriage return and another for line feed.But it is converted back to single char during input and 2 chars during output.so this is posing a prob.when i input a file to make some changes send it back and another program needs it for the same purpose because now the size is changed. please help.

ANOTHER THING
can someone suggest a way to display * instead of a character during input ie the password field in Console programs?
__________________
God Does Not Play Dice
-Albert Einstein
Shikher_neo is offline  
Old 13-04-2008, 06:07 PM   #6 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: help wid /n

Use a non echoing getchar() method. And for each character grab, send * to stdout. It depends on your platform though, on Linux I use curses/ncurses for achieving this (noecho() function).

And same goes for your \n. Windows does the 2 things - Carriage Return and Line Feed (CRLF), while on Linux it'd just be a single Line Feed (LF), and on Macintosh it is just a Carriage Return (CR). Windows is the only one doing both characters.

I guess you can intercept that behavior since you know it happens that way?

P.s. What language? Some have inbuilt password masking functions.

P.p.s. I just realized that \n is just for newline, and not for carriage return too, which is \r. So I don't know how its occupying 2 bytes if its not specified to, maybe its Windows indeed at work? Perhaps use \n\r together to avoid this confusion.
__________________
Harsh J
www.harshj.com

Last edited by QwertyManiac; 13-04-2008 at 06:17 PM.
QwertyManiac is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:57 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2