This piece of code acts a little strange for my taste. Please, does anyone want to explain why? And how to make "\ n" be interpreted as a special char?
beco@raposa :~/tmp/user/foo/bar$ ./interpretastring.x "2nd\nstr" 1st str 2nd\nstr beco@raposa :~/tmp/user/foo/bar$ cat interpretastring.c
In the bottom line, it is assumed that the second line will be printed in two lines, like the first. This program is a simplification. The real program has problems reading from a file using fgets (rather than the SO argument for argv , as here), but I think the solution here will also solve there.
source share