how to write a new line?
how will u write below to a empty file ?
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
1 2 3 4 5 6 7 8 9 10 11
|
string write_stuff = "
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
"
WriteFile(handle, write_stuff, Bytes_that_need_to_write, BytesWritten, NULL);
|
does it OK? or need to write a new line by /n (C syntax) ?
Last edited on
You need to 'escape' the newline literals. You also need to 'escape' the double quotes. Also, don't forget your statement terminators (semicolons).
1 2 3 4 5 6 7 8 9 10
|
string write_stuff = "\
<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\">\
<security>\
<requestedPrivileges>\
<requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\"></requestedExecutionLevel>\
</requestedPrivileges>\
</security>\
</trustInfo>\
";
WriteFile(handle, write_stuff, Bytes_that_need_to_write, BytesWritten, NULL);
|
Hope this helps.
i find a usfel example just before
/n is before the line need to output~ ~
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
include <iostream>
size_t getPtrSize( char *ptr )
{
return sizeof( ptr );
}
using namespace std;
int main()
{
char szHello[] = "Hello, world!";
cout << "The size of a char is: "
<< sizeof( char )
<< "\nThe length of " << szHello << " is: "
<< sizeof szHello
<< "\nThe size of the pointer is "
<< getPtrSize( szHello ) << endl;
}
|
Last edited on
Topic archived. No new replies allowed.