Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  asdf
Language: C/C++
Code:
/* http://www.onlinecompiler.net/ */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char** argv)
{
    FILE * fp;
    char buffer[255]; 
    char *ptr; 
    double x; 
    char delimiter[] = " "; 

    if(argc<2) exit(EXIT_FAILURE); 

    fp = fopen(argv[1], "r");
    if (fp == NULL)
        exit(EXIT_FAILURE);

    while(fgets(buffer, 255, (FILE*) fp)) {
        ptr = strtok(buffer, delimiter); 
        x = atoi(ptr); 
        if(x>0) printf(buffer);      
    }

    fclose(fp);
    exit(EXIT_SUCCESS);
}
          
          
          
               
Comments: