The * or -> operator must be applied to a pointer
"К указателю должен быть применен оператор * или ->",
Оператор * или-> должен быть применен к указателю
Результат - 252
Почему не выводится 010?
Какой тип данных используется для двоичных чисел?
Почему не выводится 010?
БЕЗ материала для новичков
public class User
{
//....
public string getID()
{
return UserID;
}
}
struct Message
{
public int contentID;
public string content;
public string userID;
public string contentTime;
}
public class UserContent
{
public List<Message> messsages;
public UserContent(...)
{
...
}
public addMessage(..., User user)
{
//...
messages.Add(..., user.getID());
}
public findMessages(User user)
{
//...
}
}
static void Main(string[] args)
{
//...
var morpheus = new User(1,"Morpheus","Zion","Dec 15,1985","Jan 12, 2010",UserRole.Administrator);
var trinity = new User(2,"Trinity","Zion","May 10,1980","Sep 6, 2012", UserRole.Administrator);
UserContent content = new UserContent(...);
content.addMessage(1, "Hello Zion!", morpheus, "May 24,2018");
content.addMessage(1, "Hello Zion!", trinity, "May 24,2018");
Console.ReadKey();
}
extern "C" __declspec(dllexport) int* CallNewProccess()
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
if(!CreateProcess(NULL, const_cast<WCHAR*>(L"cmd"), NULL, NULL,
FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi))
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
return 0;
}
return pi.hProcess;
}
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
class WinApiClass
{
[DllImport("DLL4.dll")]
[DllImport("kernel32.dll", SetLastError=true)]
static extern bool CloseHandle(IntPtr hObject);
public static extern IntPtr CallNewProccess();
}
static void Main(string[] args)
{
IntPtr hndl = 0;
try
{
hndl = WinApiClass.CallNewProccess();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
if( hndl != 0 )
{
CloseHandle(hndl);
}
Console.WriteLine("Press any key to continue...");
Console.ReadKey(true);
}