reading newline

This is a discussion on reading newline within the C Programming forums, part of the General Programming Boards category; I would like to read a newline and store it in a variable.
I tried reading a \n from a ...

I would like to replace all the a's in the text file with \n and all the b's in the text file with \t. How can i archieve this ??
coz my current code it only replace all the a's with ' and all the b's with \. every each of ' , \ , n , \ , t and ' are being read in as character instead of just \n and also \t. I will appreciate if some one is able to modify the code so that it is able to read in \n as a character and \t as a character so that both the character are able to replace the a's and b's in the text file.

Originally posted by winsonlee I would like to replace all the a's in the text file with \n and all the b's in the text file with \t. How can i archieve this ??
coz my current code it only replace all the a's with ' and all the b's with \. every each of ' , \ , n , \ , t and ' are being read in as character instead of just \n and also \t. I will appreciate if some one is able to modify the code so that it is able to read in \n as a character and \t as a character so that both the character are able to replace the a's and b's in the text file.

The problem is from the commande line the values in testing '\n\t' < textfile.TXTare characters ', \, n, and t. From the command line you cannot pass in a newline and tab. In your main() you'd have to parse your argv[1] and replace the characters \ & n with the single character '\n'