423,850 Members | 1,555 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,850 IT Pros & Developers. It's quick & easy.

input file and output file .csv file to .txt file

P: 5
input.csv (fp1)

FILE *fp1, *fp2;

fp1 = fopen ("input.csv", "r");
fp2r = fopen ("output.txt", "w");

fprintf(fp2, "Anil got %f GPA\n", anil);
fprintf(fp2, "Syam got %f GPA\n", syam);
fprintf(fp2, "Kumar got %f GPA\n", kumar);
fprintf(fp2, "Suresh got %f GPA\n", suresh);

In this condition i will take only before "," my variable and after "," variable value.
ex: if i entered anil in program it should be replesed with 7.8

output.txt (fp2)
Anil got 7.8 GPA.
syam got 9.2 GPA.
kumar got 6.9 GPA.
Suresh got 8.6 GPA.

Please let me explain this problem.
Attached Images
File Type: jpg C_Programming_1.jpg (130.1 KB, 9 views)
2 Weeks Ago #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 9,196
I'm not sure what you are trying to do. But you never read the .csv file. All you do is close it.

The values in the variables are the ones put in by the program and they never change. Those are the values you display.
2 Weeks Ago #2

P: 5
Yes, that is in-completion program.
Output copied manually.
Basically, I have .csv file and I want to copy sum date in tow.text file
Please, if you know solution, let me know and attached .jpg for reference.
2 Weeks Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.