(I sent earlier with no response, I figured I would resend hoping to
get someone to look at it that might know answer)
I am trying to use Vectors of structures in my program. My example
below needs to only read the vector of structs but other segments of
code will need to add items so in some cases I will pass it to read
but in another case I will need to add to the vector.
The main problem I run into is passing the vector of structs to a function i.e.
typedef struct {
string Central_Patient_Id;
string Match_Score;
string Store_Number;
string Last_Name;
string First_Name;
string Middle_Name;
string DOB;
string Address_1;
string Address_2;
string City;
string State;
string Zip;
string Phone;
string Insurance_Card_Id;
} MatchData;
…
vector <MatchData> DossiaOutMany;
LineProcessOut(Req,DossiaOutMany,parmFileOut);
I am sorry I am not mentioning specific error messages. I am working
on a Unix compiler (from a Remote Desktop Windows machine) without
Internet Access so cutting and pasting errors over to my Windows
machine is a pain.
void LineProcessOut(RequestData parmReq,vector <MatchData>&
parmMatch,string& parmFileOut)
{
std::ofstream responsefile;
responsefile.open(parmFileOut.c_str(),ios::app);
int VectorCounter;
for(VectorCounter=0; VectorCounter <
parmMatch->size(); VectorCounter++)
{
responsefile <<
parmReq.Dossia_Request_and_Response_Internal_ID << ",";
responsefile << parmReq.Batch_Internal_ID << "," ;
responsefile <<
parmMatch[VectorCounter]->Central_Patient_Id << "," ;
responsefile << parmMatch[VectorCounter]->Match_Score;
responsefile << "\n";
}
responsefile.close();
} // end LineProcessOut
#1 the line
responsefile <<
parmMatch[VectorCounter]->Central_Patient_Id << "," ;
throws an error.
responsefile <<
parmMatch[VectorCounter].Central_Patient_Id << "," ;
does not work either.
#2
I tried
void LineProcessOut(RequestData parmReq,vector <MatchData>
*parmMatch,string& parmFileOut)
as well to pass parameters.
I receive errors of course about passing the parameters either way!
Must be something simple. I like vectors (finally something to counter
the poor arrays in C++) but I prefer to process my data in granular
functions not in same code block. Every internet tutorial I found does
not ever pass the vectors to functions.
------------------------------------
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.Yahoo!
Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/c-prog/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/