I have written a C program to get all the possible combinations of a string. For example, for abc, it will print abc, bca, acb etc. I want to get this output in a separate file. What function I should use? I don’t have any knowledge of file handling in C. If somebody explain me with a small piece of code, I will be very thankful.
I have written a C program to get all the possible combinations of a
Share
Using function
fopen(andfprintf(f,"…",…);instead ofprintf("…",…);wherefis theFILE*obtained fromfopen) should give you that result. You mayfclose()your file when you are finished, but it will be done automatically by the OS when the program exits if you don’t.