I've placed a CSV file into an array with C++ with each row being a single array element, but the file contains many, many columns that I don't need. I only need columns 1,2,3,4,6,7 out of about 50. Is is best to read the full value into the array and then edit it or only read in those values that I need? Either way, I'm stuck and don't know how to proceed either way. I'm new at this and I've been unable to find resources about this online. Any help would be appreciated.
johnnyrocket 0 Newbie Poster
Recommended Answers
Jump to PostI've placed a CSV file into an array with C++ with each row being a single array element, but the file contains many, many columns that I don't need. I only need columns 1,2,3,4,6,7 out of about 50. Is is best to read the full value into the array and …
Jump to PostRemember I'm new at this, so I'm sure my code is horrible. This is in Visual Studio 2005. The Console::WriteLine and the cout of the lineCount are only for my purposes to make sure the program was actually working. They will be removed later.
#include "stdafx.h" #include <iostream> …
Jump to Post…Ok. So it looks like I was approaching the problem incorrectly. If I create the 2-dimensional array, I think I can remove entire columns using a loop with ArrayList->RemoveAt. For example, to remove column 5: theArray->RemoveAt[5] and iterate through the end of the rows. I'll give it a shot. Thanks.
All 12 Replies
WolfPack 491 Posting Virtuoso Team Colleague
johnnyrocket 0 Newbie Poster

iamthwee
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
johnnyrocket 0 Newbie Poster
Salem 5,265 Posting Sage
johnnyrocket 0 Newbie Poster
Salem 5,265 Posting Sage
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
johnnyrocket 0 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

iamthwee
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.