c file compilation

Ads

 
 

Share on Google+Share on Google+

kaladevi
c file compilation
0 Answer(s)      5 years ago
Posted in : CVS

how to run and give input to the following program?

/* convert cvs data to libsvm/svm-light format */
include 
include 
include 

char buf[10000000];
float feature[100000];
int main(int argc, char **argv)
{
FILE *fp;

if(argc!=2)
 { 
fprintf(stderr,"Usage %s filename\n",argv[0]); 
}

if((fp=fopen(argv[1],"r"))==NULL)
{
fprintf(stderr,"Can't open input file %s\n",argv[1]);

}
while(fscanf(fp,"%[^\n]\n",buf)==1)
{
int i=0,j;

char *p=strtok(buf,",");
feature[i++]=atof(p);

while((p=strtok(NULL,",")))

        feature[i++]=atof(p);


//      --i;
    /*

if ((int) feature[i]==1)
printf("-1 ");
else
printf("+1 ");
    */
    //  
printf("%f ", feature[1]);

    printf("%d ", (int) feature[0]);

    for(j=1;j<i;j++)

        printf(" %d:%f",j,feature[j]);



printf("\n");

}
return 0;

}
Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
c file compilation
c file compilation  how to run and give input to the following... **argv) { FILE *fp; if(argc!=2) { fprintf(stderr,"Usage %s filename\n... open input file %s\n",argv[1]); } while(fscanf(fp,"%[^\n]\n",buf)==1) { int i
how to acces file in c - WebSevices
how to acces file in c  How to acces file in c.... I have doubt on visual c++ ... how to create dialog control in visual c
Advertisements
objective c read file line by line
objective c read file line by line  Please explain how to read files in Objective C line by line
C file delete example
C file delete example       This section illustrates you to delete a file in C. You can see... on the console. Here i am using TurboC++ IDE and my source file is in the C:\TC\BIN
C file rename
C file rename       This section illustrates you to rename a file in C. You can see in the given example that we want to replace the name of the text file MYFILE.txt
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used
C file fseek() function
C file fseek() function This section demonstrates the use of fseek() function in C. This function sets the file position indicator for the stream pointed to by stream or you can say it seeks a specified place within a file and modify
c++
c++  Write a console based C++ program that reads student information from a text file, build an array of objects of type class StudentInfo... name with the minimum GPA 7) Display Student GPAs as Letter Grades (A, B, C, D
C file fsetpos() function
C file fsetpos() function This section demonstrates the use of fsetpos() function in C. The function fsetpos() is used to set the position of the stream... from the function fgetpos(). Its syntax is: fsetpos(File *stream,const fpos_t
C++
C++  How can i write this in dev c
c#
c#  how to find out the size of the BMP image in C
C++
C++  How can i write this in dev c
c++
c++  use a prgrm as an example to xplain-: a)class b)object c)message d)cope resolution operator
c++
c++  write a programme that calculates the area and circumference of a rectangle
c#
c#  how to find out the size of the BMP image
C++
C++  dear sir How to create windows form application for login screen using C++? USER Name -TESTADMIN Password -testuser
c++
c++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
c++
c++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
C++
C++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples
C++
C++  Describe the principle advantages of deploying a linked list versus a static array when implementing a Queue or a Stack
c++
c++  write a prgrm tht accepts 3 integer values,then with a function to swap the values
C++
C++  Trace the bubble sort using the following integers,which represent the elements in an array. 5,7,3,8,6,7,3
C file open example
C file open example       This section demonstrates you how to open a file in C.  The header...++ IDE and my source file is in the C:\TC\BIN directory and the output file
C++
C++  I have been asked to write a programme that gets five values,gets the sum,average and product please help me
C#
C#  i need a code that will make program perform the basic operations upon the data Listview save, update and cancel
c++
c++  write a program that gets a key or character from the keyboard and displays it ASII code in decimal, hexadecimal and binary form.It must also give a description of the key pressed
c++
c++  write a prgrm tht calculates the surface area of a cylinder.the prgrm shld find the circumfrance and have a function that calculates the fadius and another to calculate the surface area
C++
C++  write a prgrm tht gets five values,gets the sum,average &...; #include <conio.h> void main() { clrscr(); int a,b,c,d,e,sum; float average...;>b>>c>>d>>e; sum=a+b+c+d+e; average=sum/5; product=a*b*c*d
c++
c++  .write a program that accepts 5 subjects of a student,it should have a function to calculate the average & another function to grade.grade should be as follows-<40=E,40-49=D,50-59=C,60-69=B & >70