C++. How to run executable files in OS
#include <cstdlib>
void main() {
char* startUP = "C://myprogramm.exe";
system(startUP);
}
CLR/C++. fatal error C1190
Challenge:
fatal error C1190: managed targeted code requires a '/clr' option
Solution:
You need to create CLR Empty project in your Visual Studio and have to add code.
fatal error C1190: managed targeted code requires a '/clr' option
Solution:
You need to create CLR Empty project in your Visual Studio and have to add code.
JavaScript. Простой способ обхода механизма кэширования
В Ajax часто приходится обновлять содержимое веб-странички. Но при этом можно столкнуться с проблемой ее обновления. Многократные обращения к сценарию на сервере будут выдавать одинаковый результат. Таков механизм кэширования. Есть простой способ обойти механизм кэширования. Для этого нужно изменять URL обращений к сценарию следующим образом:
var url = "getUpdate.php";
url = url + "?dummy=" + new Date().getTime();
getTime() метод возвращает время в милисекундах (отсчет от 1970/01/01). В результате получим:
getUpdate.php?dummy=1334208621062
getUpdate.php?dummy=1334208674440
getUpdate.php?dummy=1334208697519
При этом сценарию не передаются данные. Главное - сценарий должен быть готовым к приему таких запросов и их обработки.
var url = "getUpdate.php";
url = url + "?dummy=" + new Date().getTime();
getTime() метод возвращает время в милисекундах (отсчет от 1970/01/01). В результате получим:
getUpdate.php?dummy=1334208621062
getUpdate.php?dummy=1334208674440
getUpdate.php?dummy=1334208697519
При этом сценарию не передаются данные. Главное - сценарий должен быть готовым к приему таких запросов и их обработки.
GNU Compiler Collection (gcc). cpp compilation fails
1) Input:
gcc -o test test.cpp
2) Output:
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
Solution. On Linux OS gcc installation is not supported 'cpp' - format file, on input gcc need put 'c' - format file:
gcc -o test test.c
Try to run compiled file:
./test
In my case it was successful. I hope it help you
gcc -o test test.cpp
2) Output:
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
Solution. On Linux OS gcc installation is not supported 'cpp' - format file, on input gcc need put 'c' - format file:
gcc -o test test.c
Try to run compiled file:
./test
In my case it was successful. I hope it help you
C++. Capture screenshot of desktop
This source on C/C++ show how make screenshots of desktop (Win32 platforms). Use it.
To download source and executable file - Click here. Good luck.
To download source and executable file - Click here. Good luck.
Call JS - file from batch - file. Print messages. Return error level
First way to call JS - file from batch - file - in command prompt:
script_name.js "argument1" "argument2"
And second way is - package-call in batch - file:
echo off
call :test
CScript //Nologo "script_name.js" "argument1" "argument2"
Set ERR=%ERRORLEVEL%
Echo %ERR%
Exit /b
For example during running inerpretation JS - file can print messages and return error level to batch - file that called it. Look JScript - file:
//Accept extern arguments
var oArgs = WScript.Arguments;
var firstItem = oArgs.Item(0);
var secondItem = oArgs.Item(1);
//Print messages include in variables or like that - WScript.Echo("test message");
WScript.Echo(firstItem);
WScript.Echo(secondItem);
//Close WScript object
WScript.Quit();
//Or can close Wscript object and return error level for example - equal "1" like //that - WScript.Quit(1);
Maybe it`s can help you in some cases by use that pseudo metods - print() and return() - in control the diferent events in scripting by batch - files.
It`s support by Microsoft Windows Script Host.
script_name.js "argument1" "argument2"
And second way is - package-call in batch - file:
echo off
call :test
CScript //Nologo "script_name.js" "argument1" "argument2"
Set ERR=%ERRORLEVEL%
Echo %ERR%
Exit /b
For example during running inerpretation JS - file can print messages and return error level to batch - file that called it. Look JScript - file:
//Accept extern arguments
var oArgs = WScript.Arguments;
var firstItem = oArgs.Item(0);
var secondItem = oArgs.Item(1);
//Print messages include in variables or like that - WScript.Echo("test message");
WScript.Echo(firstItem);
WScript.Echo(secondItem);
//Close WScript object
WScript.Quit();
//Or can close Wscript object and return error level for example - equal "1" like //that - WScript.Quit(1);
Maybe it`s can help you in some cases by use that pseudo metods - print() and return() - in control the diferent events in scripting by batch - files.
It`s support by Microsoft Windows Script Host.
Subscribe to:
Posts
(
Atom
)