Hi I've been working on a pretty basic program, however I've run into a couple of problems that I've been playing around with for about an hour and I just can't figure it out.

#include <fstream>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string.h>
using namespace std;

const int MAX = 100;
const int MAXINV = 100;
const int ROWS = 4;

void view(char string2[100][4], int * inv, fstream& hardware); 
void edit(char string2[100][4], int * inv, fstream& hardware);


void main(){

	fstream hardware;
	int inv = 0;
	int c = 0;
	char input;
	char string1[MAX];
	char string2[100][4];
	char *delim = ";";
	char *token;
	hardware.open("hardware.dat", ios::in | ios::out);
	if (hardware.fail()){
		cout << "File Open Failed.\n";
		exit(1);
	}

	cout << "Menu\n" << endl
    	 << "Action:            Enter: " << endl
		 << "View Inventory     V" << endl
		 << "Edit Entry         E" << endl
		 << "Quit               Q" << endl;
	cin >> input;

	switch(input){
		case 'V':
		case 'v':
			view(string2, &inv, hardware);
			break;
		case 'E':
		case 'e':
			edit(string2, &inv, hardware);
			break;
		default:
			exit(1);
	}


	while (! hardware.eof()){
		cin.getline(string1, MAX); 
		token = strtok(string1, delim);

		while (token != NULL){
			cout << "token " << c << " is " << endl << token << endl;
			if (c >= ROWS){
				c=0;
				inv++;
			}

			string2[*inv][c] = token;
			token = strtok(NULL,delim);
			c++;
		}
	}
	hardware.close();
}
void view(char string2[100][4], int * inv, fstream& hardware)
{
	int i,j;
	for (i=0; i <= *inv; i++){
		for (j=0; j <= 4; j++){
			cout << string2[i][j] << endl;
		}
	}
}

void edit(char string2[100][4], int * inv, fstream& hardware)
{
	int num;
	int i,j;
	char string1[MAX];
	cout << "Enter Inv. Number: ";
	cin >> num;

	for (j=0; j <= 4; j++){
		cout << string2[num][j] << ";" << endl;
	}

	cin.getline(string1, MAX);
	hardware.seekg(0,ios::beg);
		for (i=0; i <= *inv; i++){
			for (j=0; j <= 4; j++){
				cout << string2[i][j] << ";" << endl;
		}
	}
}

I'm getting the errors:

c:\...\problem2.cpp(64) : error C2100: illegal indirection
c:\...\problem2.cpp(64) : error C2440: '=' : cannot convert from 'char *' to 'char'
There is no context in which this conversion is possible

These errors reference

string2[*inv][c] = token;

You have bigger problems than this...

void main() <-- really?

char *delim = ";"; <-- You need to learn what a pointer is, and how to use them, what you do here should ring a million alarm bells.

The error you are getting is because you are trying to assign a _char pointer_ to a char.

commented: Yes +4

@OP:
Look at your declarations, the variable inv is not a pointer, it is an int. You can not dereference an int. Move the '*' from inv to token.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.