>>Following code gives me an error when I use text field in CSV file instead of float or integer fields

what compiler? post the errors. The compiler should give you warnings that it is converting int to char and may lose data.

what does the csv file look like -- can you post the first two or three lines? Are the values between -127 and 126 because that is the range of signed char. If the csv file contains larger numbers then you will have to redeclare the matrix as a 2d array of ints, not chars

>>Following code gives me an error when I use text field in CSV file instead of float or integer fields

what compiler? post the errors. The compiler should give you warnings that it is converting int to char and may lose data.

what does the csv file look like -- can you post the first two or three lines? Are the values between -127 and 126 because that is the range of signed char. If the csv file contains larger numbers then you will have to redeclare the matrix as a 2d array of ints, not chars

I am facing a problem while assigning the line value to two dimensional array.
So how should I assign the value of line variable to the two dimensional array as follows

Basically I want to read all the values in the matrix. Based on these values I have to conditionally replace the values in my application. That is for a given row I want to find the value of particular field in the row and then extract the the value of other field in the same row using the matrix(2-D array). Here is my

Its obvious from the fle contents that atoi() won't work because the file contains a mixture of text and numbers. And since that is NOT a comma-separated file attempting to read up to the comma will fail. As Salem mentioned the columns must be separated by tabs or just simply spaces.

here is a way to do it without any knowledge of the number of words on a line. matrix_points must be defined as a 2d array of strings -- you have it declared as a 2d array of characters. You can't store an entire string in just one character.

This(following) is the code I am using which is almost same as yours. Certain c functions are not working in VC++ like push_back, substr etc. Still output is always the first field, i.e. ECU ID in the format above.
Can you please send me the code more in the line of VC++(if not C++ is also OK)

>> VC++
That is the name of a specific compiler, not c programming language. Of course it supports c++, vector and push_back. You are writing a c++ program, if you want to use vector c++ class as I illustrated you have to include <vector> header file.

>>QString linecol
QString is a non-standard c++ class that M$ apparently developed for their compilers. I haven't used managed c++. the strings I posted are std::string from <string> header file, and maybe that is why you couldn't get it to work.

>> matrix_points[r][c] = line;

I mentioned this before -- you can't do this because matric_points is a 2d array of characters, not a 2d array of pointers

how is line declared? if it is a char array, then the code above will not work. If it is QString or std::string it still will not work. You are mixing c and c++ -- attempting to use c++ techniques on C string, or attempting to use C techniques on C++ string class. But I don't know which it is because you didn't post enough code.

Hi Dragon,
Thanks for the reply. It works. Now the problem comes when I assign the matrix_points, which is of type QString to a variable in my application which is of ACE_WString Type, it gives a problem. What kind of typecasting method can we apply to overcome it?

I don't know why you are using those odd-ball, non-standard c++ classes, maybe the university requires them? But anyway, looks like ACE_WString has a constructor that takes const char*, so just pass the right QString method that makes that conversion for you. You'll have to look it up.

This is what my whole code looks like. I am unable to locate the constructor which would help store into my codeText variable(ACE_WString) the value of matrix_points(QString). As you see the paramter in the function of my application requires me to pass ACE_WString type. Basically I want to assign QString type value to ACE_WString variable.

Hi Dragon,
Thank you. Actually I am able to manipulate the values from the csv file based on the row,column concept. I have now need to manipulate the values based on the header names. Concept being same as last, I would like to query based on column names.

Your dilema seems vague. I assume you have developed a 2 dimensional table of values like tableName[rowIndex][colIndex] and each column has a name/header/identifier. I further assume you want to be able to find a given column identified by it's name/header/identifier and be able to access the elements of the column to manipulate them in some fashion. If that's correct, then you can view the headers to be a row of data just like a row of values making up the body of the table itself and use a loop to search for the header/identifier you want. To do that you can hold the row index stable and vary the column index. Then to access all the values in the column you hold the column index stable and vary the row index.

Hi Lerner,
Thanks! So far I have done the same. My next step is to match the value till couple of columns in a row and if 2 rows are almost similar the value for the row which matches more closer should be displayed.