Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

quotize.c File Reference

#include <stdio.h>

Go to the source code of this file.


Defines

#define NBUF   256

Functions

int main (int argc, char *argv[])

Define Documentation

#define NBUF   256
 

Definition at line 9 of file quotize.c.

Referenced by main().


Function Documentation

int main int    argc,
char *    argv[]
 

\** File : SUMA.c

Author:
: Ziad Saad Date : Thu Dec 27 16:21:01 EST 2001
Purpose :

Input paramters :

Parameters:
param  Usage : SUMA ( )
Returns :
Returns:
Support :
See also:
OpenGL prog. Guide 3rd edition , varray.c from book's sample code
Side effects :

Definition at line 11 of file quotize.c.

References argc, and NBUF.

00012 {
00013    char buf[NBUF] , buf2[NBUF*2];
00014    int ll , num=0 , ii , jj ;
00015 
00016    if( argc < 2 ){
00017       fprintf(stderr,"Usage: quotize name < input > output\n"
00018                      "Turns a text file into a C array of strings\n"
00019                      "initialized into an array 'char * name[]'.\n"
00020              ) ;
00021       exit(0) ;
00022    }
00023 
00024    printf("static char * %s[] = {\n",argv[1]) ;
00025    while( fgets(buf,NBUF,stdin) != NULL ){
00026       ll = strlen(buf) ; if( ll == 0 ) break ;
00027       if( buf[ll-1] == '\n' ) buf[ll-1] = '\0' ;
00028       for( ii=0,jj=0 ; buf[ii] != '\0' ; ){
00029          if( buf[ii] == '"' || buf[ii] == '\\' ) buf2[jj++] = '\\' ;
00030          buf2[jj++] = buf[ii++] ;
00031       }
00032       buf2[jj] = '\0' ;
00033       printf("   \"%s\\n\" ,\n" , buf2 ) ;
00034       num++ ;
00035    }
00036    printf("   NULL } ;\n") ;
00037    printf("#define NUM_%s %d\n",argv[1],num) ;
00038    exit(0) ;
00039 }
 

Powered by Plone

This site conforms to the following standards: