Code:
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#define MAXWORD 15
#define MAXLEN 20
void printName (void);
void sort(char strArray[][MAXLEN], int currentsize);
int binSrch(char strArray[][MAXLEN], char *item,
int lowerbound, int upperbound);
void printArray(char strArray[][MAXLEN], int currentsize);
void openFile(char *pFPIN, char strArray[][MAXLEN]);
int srch(char srtArray[][MAXLEN], int *item);
int getValue(void);
int main (int argc, char *argv[])
{
char strArray[MAXWORD][MAXLEN];
int item, result;
int currentsize;
printName(void);
if (argv[2] != 3)
printf("\nNot enough Command Line arguments.");
else if (argv[2] < 1 || argv[2] > 15)
printf("\nNumber %d is not between 1 and 15.", argv[1]);
openFile(argv[2], *strArray);
return 0;
}
void openFile(char *pFPIN, char strArray[][MAXLEN])
{
if((*pFPIN = fopen(argv[2], "r")) !=NULL)
{
for (i = 0; i < argv[2]; i++)
fscanf(*pFPIN, "%s", &strArray[i]);
}
}
What else do I need to add/modify to get this thing to work (just read in the strings), I'm still confused as to how to make all of this work... Everytime I think I get the hang of it, it throws me for another loop.
The code above is just the function definition for the openFile code, as well as the main( ) code.
What else needs to be done?