DIGIT-ARC read-only archive · snapshot: July 23, 2026

help wid /n

6 posts · originally from https://geek.digit.in/community/threads/help-wid-n.84686/

Shikher_neo
Shikher_neo Original post #1
Apr 7, 2008 at 3:38 PM
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
victor_rambo
Apr 7, 2008 at 3:59 PM
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.
A
aakash #3
Apr 8, 2008 at 4:11 PM
Yeah, true. Use \n instead of /n
T
Apr 8, 2008 at 4:17 PM
/n will be equal to two characters. One for '/' and other for 'n'
Shikher_neo
Apr 13, 2008 at 5:55 PM
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?
QwertyManiac
Apr 13, 2008 at 6:07 PM
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.