Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÓÃC/C++³ÌÐò¿ØÖÆ»·¾³±äÁ¿

In C++, how do i go about using setenv to set the display?  I need to set it like this:
export DISPLAY=0.0
1¡¢setenv("DISPLAY",":0.1",1);
If you're calling the xrandr functions from your C++ program, then I would expect setenv() should work for you. The 3rd argument of 1 tells setenv() to overwrite any previous value of argument 1 (DISPLAY). You'd be out of luck if xrandr cached the display name though. In that case, you'd have to re-invoke a program from a shell script: the shell script could set the DISPLAY each time before starting your program. That would be less C++ coding
#include <stdlib.h>
#include <stdio.h>
int main(){
char *env1 = getenv("test11");
printf("test11=%s\n", env1); //show current env variable
setenv("test11","abcd",1); //reset it
env1 = getenv("test11");
printf("test11=%s\n", env1);
//this value reset is gone after the program finished
return 0;
}
g++ setenv.cpp -o mysetenv


Ïà¹ØÎĵµ£º

ʹÓÃCÓïÑÔÀ©Õ¹Python(Èý)

ÉÏһƪÖÐÎÒÃÇÒѾ­Á˽âÈçºÎÔÚPython³ÌÐòºÍCÄ£¿éÖ®¼ä½øÐÐÖµµÄÏ໥´«µÝ£¬ÏÖÔÚÎÒÃÇÀ´½øÈëʵ×÷½×¶Î£¬¿´¿´ÈçºÎ½«Ò»¸öCÓïÑÔ¿ª·¢µÄ¿ªÔ´mp3±à½âÂë¿âLAME°üװΪһ¸öPythonÏ¿ÉÒÔʹÓõÄÀ©Õ¹Ä£¿é¡£Ê×ÏÈÈ¥http://lame.sourceforge.net/download.phpÏÂÔØLAMEµÄÔ´´úÂ룬ȻºóÇл»µ½rootÓû§±àÒëÔ´´úÂ룬./configure
make
make instal ......

C/C++ ±ÊÊÔ¡¢ÃæÊÔÌâÄ¿´ó»ã×Ü


1.ÇóÏÂÃæº¯ÊýµÄ·µ»ØÖµ£¨ ΢Èí£©
int func(x)
{
    int countx = 0;
    while(x)
    {
          countx ++;
          x = x&(x-1);
    ......

¹¹½¨±Ê¼Ç£ºÎªjava hotspot vm´´½¨vc++¹¤³Ì

      Ê×ÏÈÏÂÔØopenjdk´úÂë°ü£¬http://download.java.net/openjdk/jdk7/£¬ÕâÀïÏÂÔØµÄÊǵ±Ç°µÄ×îа汾b94£¬openjdk-7-ea-src-b94-20_may_2010.zip¡£       ½âѹËõopenjdk-7-ea-src-b94-20_may_2010.zipµ½D:\JVM¡£ÔÚD:\JVM\openjdkÏ´ò¿ªREADME-builds.htmlÎļþ¡£° ......

ʹÓÃCÓïÑÔÀ©Õ¹Python(Îå)

ÉÏһƪÖÐÎÒÃÇÔÚpython¶ËµÄ×ö·¨ÊÇÿ´Î¶Áȡһ¸öÊý¾Ý¿é£¬È»ºó½«Õâ¸öÊý¾Ý¿é´«µÝ½øCÀ©Õ¹Ä£¿éÖÐÈ¥£¬µ«¶ÔÓÚÄ¿±êÎļþµÄÊý¾ÝдÈëÊÇÔÚCÀ©Õ¹Ä£¿éÖÐÍê³ÉµÄ£¬µ«Æäʵ¿ÉÒÔ¸üÃæÏò¶ÔÏóÒ»µã£¬²»ÊÇÂð£¿Ô­À´outfpÊÇÒ»¸öÎļþÖ¸Õ룬²»Èç¸Ä³ÉÒ»¸ö´ÓPythonÖд«µÝÒ»¸öÎļþ¶ÔÏóµ½CÄ£¿éÀïÈ¥£¬Õâ¸öÎļþ¶ÔÏóÓÐ×Ô¼ºµÄwrite·½·¨£¬ÕâÑùÔÚCÀ©Õ¹Ä£¿éÖÐÄã¾Í¿ÉÒÔ ......

¹ØÓÚ¼òµ¥cµÄ´Ê·¨·ÖÎöÆ÷

Õâ¶ÎÔ´ÂëÄÜÔÚlinuxÏÂÔËÐУ¡£¡£¡ ÄÜʶ±ðСÊý
#include<unistd.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
/*#define  NULL          0*/
/*    ×Ô¶¨Òå±äÁ¿      */
#define&n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ