c file compilation

c file compilation

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;

}
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
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
Advertisements
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
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot exist ( though i imported it) & cant recognise SUCCESS etc symbol.i think i
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot exist ( though i imported it) & cant recognise SUCCESS etc symbol.i think i
command prompt is compilation is not working
is compiling and generation the class file using javac c:\helloworld.java command and the class file is also getting generated when i run the class file using java...command prompt is compilation is not working   Dear java users can
compilation fail
compilation fail  package jsptube.tutorials.servletexample; import javax.servlet.GenericServlet; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import java.io.IOException; import
java Compilation
java program compilation time following error is occur in my system Note
java Compilation
java program compilation time following error is occur in my system Note
java Compilation
java program compilation time following error is occur in my system Note
compilation error
compilation error  Hi my program below is not compiling,when I try to compile it i'm getting the error message "tool completed with exit code 1".The loop has to be at the end of the program can you help me. Blockquoteimport
compilation errors
compilation errors  package jsptube.tutorials.servletexample; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import
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
compilation error - Java Beginners
compilation error  class s { public static...[]) { int a=10; //Decimal number int b=010; //Octal number int c=0x10... = 16(16*1+16*0): result ="+c); } } Thanks RoseIndia Team
java compilation error - Hibernate
java compilation error  hi, i have made an registration page whosevalues should be inserted into database. i have used hibernate and eclipse it is working fine. but when i make a war file and deploy it using ant and then run
C++
C++  How can i write this in dev c
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++  use a prgrm as an example to xplain-: a)class b)object c)message d)cope resolution operator
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++
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 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++  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++  Trace the bubble sort using the following integers,which represent the elements in an array. 5,7,3,8,6,7,3

Ads