Friday 15 May 2015

file - C puts() without newline -


I currently have this program that prints a text file on the console, but each line has an extra new line below it If the text

Hello world

this product is hello

the world

this code is

  # Include & lt; Iostream & gt; # Include & lt; Stdio.h & gt; #include & lt; String.h & gt; using namespace std; Int _tmain (int argc, _TCHAR * argv []) {FILE * fp; Four input [80], f = 'a'; Four key [] = "exit \ n"; Int q; Fp = fopen ("c: \\ user \\ kostas \\ desktop \\ original.txt", "r +"); While (! FIF) {fgets (input, 80, FP); Put (input); } Fclose (fpose); Return 0; }    

The library connects the character of the newline by specification. Instead, you can use printf , where you can print with a format string:

  printf ("% s", input);    

No comments:

Post a Comment