/*  
    File:               vpw_wlist.c
    Author:             michael stevens
    Experiment:         Viewing position effect (words)
                        Stevens & Grainger 2003
                        
        Read stimulus lists

            20 practice words (5letters) - practice.txt
            75 5 letter words - five.txt
            105 7 letter words - seven.txt
                (==15 for each fixation position)

*/

#include <tscope.h>

#define NPRACTWORDS     20
#define N5WORDS         75
#define N7WORDS         105

char wpract[NPRACTWORDS][20];
char w5[N5WORDS][20];
char w7[N7WORDS][20];

void readwords()
{
    int i;
    FILE *fp;

    // open practice file
    fp = fopen("practice.txt", "r");
    if (fp == NULL) {
        printf("error opening practice.txt");
        exit(EXIT_FAILURE);
    }
    // read words
    for (i = 0; i < NPRACTWORDS; i++)
        fscanf(fp, "%s", wpract[i]);

    // close file
    fclose(fp);


    // open 5-letter file
    fp = fopen("five.txt", "r");
    if (fp == NULL) {
        printf("error opening five.txt");
        exit(EXIT_FAILURE);
    }
    // read words
    for (i = 0; i < N5WORDS; i++)
        fscanf(fp, "%s", w5[i]);

    // close file
    fclose(fp);

    // open 7-letter file
    fp = fopen("seven.txt", "r");
    if (fp == NULL) {
        printf("fout bij openen seven.txt");
        exit(EXIT_FAILURE);
    }
    // read words
    for (i = 0; i < N7WORDS; i++)
        fscanf(fp, "%s", w7[i]);

    // close file
    fclose(fp);
}

#ifndef VPW_DATA_C
int main()
{
    readwords();

    int i;
    for (i = 0; i < NPRACTWORDS; i++)
        printf("oef %03d: %s\n", i, wpract[i]);
    for (i = 0; i < N5WORDS; i++)
        printf("five %03d: %s\n", i, w5[i]);
    for (i = 0; i < N7WORDS; i++)
        printf("seven %03d: %s\n", i, w7[i]);

    return 0;
}

END_OF_MAIN();

#endif                          // VPW_DATA_C


top
Persoonlijke pagina Universiteit GentTscope
Allegro | Cygwin | Gcc
© See license.html for copyright information