Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,047 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,556 people online right now. Registration is fast and FREE... Join Now!




excel file handling in c

 
Reply to this topicStart new topic

excel file handling in c, hi!!! can i access the excel file column wise using turbo

ankurbahri
3 Aug, 2008 - 08:22 PM
Post #1

New D.I.C Head
*

Joined: 3 Aug, 2008
Posts: 4

CODE


#include<stdio.h>
#include<conio.h>

void main()
{
FILE *fp1;
FILE *fp2;
FILE *fp3;
char file_1[10];
char file_2[10];
int a;
char ch;
clrscr();

printf("enter the input file\n");
scanf("%s",file_1);
if((fp1=fopen(file_1,"r"))==NULL)
{
printf("Opening input file failed \n");
exit(0);
}

printf("enter the output file \n");
scanf("%s",file_2);
fp2=fopen(file_2,"w");
if(fp2==NULL)
{
printf("Opening input file failed \n");
exit(0);
}

fp3=fopen("t.txt","w");
if(fp3==NULL)
{
printf("Opening input file failed \n");
exit(0);
}

while((ch=getc(fp1))!=EOF)
{
if(ch==34||ch==32||ch==42||ch==47)putc(ch,fp3);
else if(ch==9)putc(ch=47,fp2);
else
putc(ch,fp2);
}
fclose(fp1);
fclose(fp2);
getch();
}


This post has been edited by NickDMax: 3 Aug, 2008 - 10:27 PM
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Excel File Handling In C
4 Aug, 2008 - 05:36 PM
Post #2

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,858



Thanked: 49 times
Dream Kudos: 550
My Contributions
There are quite a few resources on the Excel file format -- however most of them are not complete. The format is highly proprietary and complicated.

Excel can read other formats, the open office specification for example, CVS, etc. -- my advice would be to use one of these formats and import the data into Excel (in the past I have use CVS quite successfully on a number of projects).

you can find the "official" documentation here. and you can find some info extracted by the OpenOffice project.

I have used an open source library for Java to read Office documents. I am pretty sure that you can find a C/C++ project on the matter but I have not run across one yet.

This post has been edited by NickDMax: 4 Aug, 2008 - 05:37 PM
User is offlineProfile CardPM
+Quote Post

ankurbahri
RE: Excel File Handling In C
4 Aug, 2008 - 09:09 PM
Post #3

New D.I.C Head
*

Joined: 3 Aug, 2008
Posts: 4

hey thnkx 4 d idea ... now what is happning is that all d columns a getting clustered and when converting the .txt or .cvs file into .xls format all the info is coming in a cell column

i also whated to know whether we can asscess the files column wise?????
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 05:17PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month