Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to export data to Excel tabular form by "fprintf&qu

Status
Not open for further replies.

chihhao

Full Member level 4
Full Member level 4
Joined
Apr 4, 2004
Messages
204
Helped
4
Reputation
8
Reaction score
3
Trophy points
1,298
Activity points
1,701
Hi
I would like to export some number to excel file but it always be
placed at location A1 without placing at A2,A3,.... in order.
Would someone please kindly advise me how to do it ?
Thanks!!!!

=================================
#include <stdio.h>
void main()
{
int index;
FILE *fptr;
fptr=fopen("c:\\temp\\C_Practice\\test.xls","a");
for(index=0;index<=100;index++)
{
fprintf(fptr,"%3d",index);
}
fclose(fptr);
}
=================================
 

Re: How to export data to Excel tabular form by "fprint

ajhsu said:
Hi
I would like to export some number to excel file but it always be
placed at location A1 without placing at A2,A3,.... in order.
Would someone please kindly advise me how to do it ?
Thanks!!!!

=================================
#include <stdio.h>
void main()
{
int index;
FILE *fptr;
fptr=fopen("c:\\temp\\C_Practice\\test.xls","a");
for(index=0;index<=100;index++)
{
fprintf(fptr,"%3d",index);
}
fclose(fptr);
}
=================================

You need to delimit the data with comma's. (Tabs would work also)

Anyways if you change the printf to "%3d," that would give you what you want. with an empty column at end or you can add some extra checks to avoid the last column.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top