The method alters the array. No copy is made. Take a look at this example:
void method(char *buff2)
{
strcpy(buff2,"CHANGHED!!!");
}
int main(int argc, char* argv[])
{
char buff[512];
strcpy(buff,"Hello there!");
printf(buff);
method(buff);
printf(buff); //doesn't say "Hello there!" anymore! Says "CHANGHED!!!"
return 0;
}
\n newline == endl
\r carriage return
\t tabulation
\v vertical tabulation
\b backspace
\f page feed
\a alert (beep)
\' single quotes (')
\" double quotes (")
\? question (?)
\\ inverted slash (\)
\0 null char means end of string
\ - Allows you to continue your string onto the next line. ex. "asdfg\
... hjkl" produces no compile errors.
Using a character array
ASCII
itoa(integer,chararray,10); //integer to string array, 10 = radix, returns the string array
TCHAR
_itot(integer,chararray,10);
Unicode
_itow(integer,chararray,10);
Using wsprintf
wsprintf(buff,"Value: %d", integer)
params are TCHAR *, so Unicode or ASCII may be used
returns "number of characters stored in the output buffer, not counting the terminating null character."
%f =float
%s=string
%c=char
%d=integer
Using the MFC CString:
CString MFCString;
MFCString.Format("Value: %d", integer);
%f =float
%s=string
%c=char
%d=integer
//is the app already running?
::CreateMutex( NULL, TRUE, TEXT("NAME-088FA2340-B10234-12343-B2346-0070967"));
if(GetLastError() == ERROR_ALREADY_EXISTS)
exit(0);
The best way to execute a program (in Windows) is to use this code:
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
if(CreateProcess("E:\\info.exe", 0, 0, 0, FALSE, 0, 0, 0, &si, &pi))
{
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
This Post will show how to access pointer to a various objects in the Document - View Architecture.