WriteFile with vector inside a vector

Hi,
I've a vector <struct> with a vector in the struct consisting of TCHAR's. I would like to use the WriteFile function to write a string to a file but how should I do it?

Here is an example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//... some code for opening file and getting a handle.

struct EXAMPLE {
	vector<TCHAR> NAME;
}

//Creating one element.
vector <EXAMPLE> (1);

//Creating array for a string.
EXAMPLE[0].NAME.assign(10);

//... adding some data to the new array.

//Write string to the file.
WriteFile(handle, (what to write?), 20, &bytes, NULL);

CloseHandle(handle);


I've tried to use &EXAMPLE[0].NAME but that only writes junk data.
What should I do?

Regards,

Simon H.A.
I found the solution after some heavily searching.
The passing to the function should be (&EXAMPLE[0].NAME[0])

Regards,

Simon H.A.
Last edited on
Topic archived. No new replies allowed.