Click here to Skip to main content
15,893,968 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to read a data using C can somebody share the code for executing and could somebody say me what is the difference between gcc and cc. Because gcc is used for compiling in Unix environment and what is cc used for.
Posted

1 solution

hi,
Look here[^] for difference between gcc and cc .

there are plenty of tutorials on internet about reading the text file in C .Like this one[^]. or here[^]

For your queries try to google it out first(this will save time) and for coding questions show your code and show what you tried already(thus people here will be able to give you better guidance). I don't mean to be rude, just a suggestion:)
 
Share this answer
 
Comments
venkat28vk 9-Oct-14 5:26am    
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
void main( )
{
FILE * fp;
char name[300],city[300],dept[300];
/* fp=fopen("sampledata.ods", "r");*/
if(!fp) {
printf("Failed to open!\n");
exit(1);
}
fp=fopen("/home/sosdt011/Desktop/sampledat.ods","r");

fscanf(fp,&name);
/* fp=fopen("/home/sosdt011/Desktop/sampledat.ods","r");*/

fprintf(stdout,"First Line is %s\n", *name);
fclose(fp);
}


This is the code and i am getting segmentation fault core dumped can someone help me to solve this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900