U
umarriaz
Dear All,
I am using this code in my c++ code and now i want to use this same
code for a c language project...
would some one please guide me what to do ??
===============================================================
#include "stdafx.h"
#include <vector> // for vector STL
using namespace std; // required
// for testing
struct MODEM
{
int index;
int snumber;
char flag;
};
int main(int argc, char* argv[])
{
vector<MODEM*> v; // vector is defined in STL (working as dynamic
array)
// mem allocate for modem structure
MODEM* test = (MODEM*)malloc(sizeof(MODEM));
// test values
test->index = 1;
test->snumber = 5556;
test->flag = 'p';
// vector array dynamically grow (index 0)
v.push_back(test);
// now get back the second modem values
MODEM* temp = v[0];
printf("MODEM[1] Index Value %d\n", temp->index);
printf("MODEM[1] Serial Number Value %d\n", temp->snumber);
printf("MODEM[1] Flag Value %c\n", temp->flag);
return 0;
}
=============================================================
waiting for an urgent response ....
I am using this code in my c++ code and now i want to use this same
code for a c language project...
would some one please guide me what to do ??
===============================================================
#include "stdafx.h"
#include <vector> // for vector STL
using namespace std; // required
// for testing
struct MODEM
{
int index;
int snumber;
char flag;
};
int main(int argc, char* argv[])
{
vector<MODEM*> v; // vector is defined in STL (working as dynamic
array)
// mem allocate for modem structure
MODEM* test = (MODEM*)malloc(sizeof(MODEM));
// test values
test->index = 1;
test->snumber = 5556;
test->flag = 'p';
// vector array dynamically grow (index 0)
v.push_back(test);
// now get back the second modem values
MODEM* temp = v[0];
printf("MODEM[1] Index Value %d\n", temp->index);
printf("MODEM[1] Serial Number Value %d\n", temp->snumber);
printf("MODEM[1] Flag Value %c\n", temp->flag);
return 0;
}
=============================================================
waiting for an urgent response ....