473,385 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

ex:
input.csv (fp1)
anil,7.8
syam,9.2
kumar,6.9
suresh,8.6

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, 301 views)
Nov 24 '18 #1
2 1418
weaknessforcats
9,208 Expert Mod 8TB
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.
Nov 24 '18 #2
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.
Nov 25 '18 #3

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

Similar topics

3
by: Pernell Williams | last post by:
Hi all: I am new to Python, and this is my first post (and it won't be my last!), so HELLO EVERYONE!! I am attempting to use "xreadlines", an outer loop and an inner loop in conjunction with...
2
by: Quick Function | last post by:
For the <input type="file">, can I select directory? Multiple directories? Thanks, qq
4
by: Carlo Marchesoni | last post by:
I really don't achieve to read a simple 'input.txt' with the following content: Jürg (Hex: 4a fc 72 67) to an identical 'output.txt' I do the following (and tried with tons of different...
3
by: UJ | last post by:
Is there any way on an input="file" to specify what the default accepted types are? I don't want to have the user even be able to see the wrong type. TIA - Jeff.
5
by: jwright | last post by:
I have decided to use a struct to collect my data. The input file is comma dilineated between almost all of the fields. Here is the code I have so far and a sample input and output file. ...
6
by: Dic4000 | last post by:
ÏÂÃæ³ÌÐò½¨Á¢²»ÁËÎļþ,²»ÖªµÀÄÄÀï³ö´íÁË? Ö»Ï붨ÒåÒ»¸öfstreamÀàÐÍÀ´Íê³ÉÊäÈëÊä³öµÄ¹¤×÷. #include<iostream> #include<conio.h> #include<fstream> using namespace std; int main()
2
by: isaac2004 | last post by:
hello i am trying to read an input file into a matrix, i have the following setup to get the file #include <iostream> #include <string> #include <fstream> using namespace std; int main()
1
by: ettarameshreddy | last post by:
Hi, I got a problem like i write a input file element like this <input type="file" name="testfile" > When i execute this i get a text box with browse. when i click browse i am abl e...
1
by: mingke | last post by:
Hi... I've been trying to make a program where the input is txt file, and the output will be saved in txt file. But, I keep getting error Message. My code looks like this: #include <stdlib.h>...
0
by: rajavemu | last post by:
Hi, I am just trying to execute the below command in command prompt and it works perfect """C:\Program Files\ccc""" -C server -t 13 -l -R -s 03/04/2013 /D/ > E:\m_bkup\mk.txt but when i...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.