I've a file as:
+a
-b
+c
+d
.
.
.
I want to print it into a file as +a -b +c +d ... into a file i.e convert \n into spaces!
Could anyone please let me know the syntax?
I've a file as:
+a
-b
+c
+d
.
.
.
I want to print it into a file as +a -b +c +d ... into a file i.e convert \n into spaces!
Could anyone please let me know the syntax?
Hmm, you seem to be creating a thread for every problem you encounter. Don't you think it would be better if you actually read through a book, or at least searched google for the answer? Or better yet, came up with a solution yourself?
it's ironic considerate rarity patron of love higher knowledge engulfs me...
Yes biv...I find this forum very helpful and thats the reason.I'm sorry if I'm bugging you.
Well, it doesn't bug me - I mean, the forums are here for help. But it just looks like you aren't even trying to learn. Obviously it's up to you.
it's ironic considerate rarity patron of love higher knowledge engulfs me...
I'm not getting much useful things from google. Also I've learnt much much more new techniques from this forum than google.
I'm highly obliged to you guys here!
why dont you read the file in as text, i.e.and then just have a conditional. read in one char at a time and then check to see if it == '\n'. if it does, output a space to a string. if not, output the char to a string. after you've read in all of the file, output the string to it or a new file. whatever you choose you want.Code:FILE *fileptr; fileptr = fopen("yourfile.ext", "rt");
at least i believe that should work...
also, you should look around cplusplus.com more often... http://www.cplusplus.com/ref/cstdio/fprintf.html
Registered Linux User #380033. Be counted: http://counter.li.org