Like Tree4Likes
  • 1 Post By Matticus
  • 1 Post By Elysia
  • 1 Post By rcgldr
  • 1 Post By Salem

how can I reboot system,with one line c++ code?

This is a discussion on how can I reboot system,with one line c++ code? within the C++ Programming forums, part of the General Programming Boards category; hi please help me. I need a short C++ code for reboot system(only c++) can I do it? thanks a ...

  1. #1
    Registered User
    Join Date
    Apr 2013
    Posts
    5

    Question how can I reboot system,with one line c++ code?

    hi
    please help me.
    I need a short C++ code for reboot system(only c++)
    can I do it?
    thanks a lot

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    2,690
    I'm assuming you did some research on this before asking. What information did you find when you entered, say, "c++ reboot" into your search engine of choice?
    dvbhot likes this.

  3. #3
    Registered User
    Join Date
    Apr 2013
    Posts
    5
    Quote Originally Posted by Matticus View Post
    I'm assuming you did some research on this before asking. What information did you find when you entered, say, "c++ reboot" into your search engine of choice?
    I test every codes I find in internet.
    but none of them,does not work!
    it impossible or possible?
    I'm so sorry for my bad EN.

  4. #4
    Registered User
    Join Date
    Jun 2012
    Location
    Morden, UK
    Posts
    127
    Controlling the computer with C++ - C++ Forum

    Could try this? A quick google search found that one.

  5. #5
    Registered User
    Join Date
    Jun 2011
    Posts
    2,690
    Perhaps you could show a bit of code you've tried that doesn't work (making sure your code is posted in code tags). You should also include your compiler and OS.

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,985
    Quote Originally Posted by samwillc View Post
    Controlling the computer with C++ - C++ Forum

    Could try this? A quick google search found that one.
    Best pay no heed to that link.
    system is bad for many reasons, among them nonportable and a security risk.
    Furthermore, there are other bad practices there, such as gets.

    Rebooting a computer is not done in a single line and depends on your OS.
    stahta01 likes this.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Jun 2012
    Location
    Morden, UK
    Posts
    127
    The point was more about how easy it is to find info on google. However, the risks of that have just been exposed!

  8. #8
    Registered User
    Join Date
    Apr 2013
    Posts
    5
    why i can't do this project
    I test every code,but it'll dose not work.
    can you upload cpp file code?

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,985
    Once again, what operating system?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Registered User
    Join Date
    Apr 2013
    Posts
    5
    Quote Originally Posted by Elysia View Post
    Once again, what operating system?
    not different...
    windows XP or 7 or both of them.
    thank's.

  11. #11
    Registered User
    Join Date
    Apr 2013
    Posts
    5
    I find a short code
    I test it without any include and worked.but could not reboot system.I think this code have a little problem but it possible.please test this code and if you can find problem,say me too.
    sorry again for my bad EN.

    Code:
    void main(){    (*(void (far *)(void))0xffff0000L)();}

  12. #12
    Registered User
    Join Date
    May 2009
    Posts
    2,764
    Quote Originally Posted by dvbhot View Post
    I find a short code
    I test it without any include and worked.but could not reboot system.I think this code have a little problem but it possible.please test this code and if you can find problem,say me too.
    sorry again for my bad EN.

    Code:
    void main(){    (*(void (far *)(void))0xffff0000L)();}
    Are you trying to shutdown the computer? Or are you trying to crash the computer?

    InitiateSystemShutdownEx function (Windows)

    Tim S.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

  13. #13
    Registered User
    Join Date
    Apr 2013
    Posts
    1,331
    You can follow this small thread from msdn forums:

    msdn_reboot.htm
    stahta01 likes this.

  14. #14
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,821
    In other words, crappy DOS only 1-line tricks.

    Mostly, you're just another script kiddie wannabe who thinks programming is trying to muck about with other peoples machines.

    People genuinely interested in programming do not ask "how do I reboot...." as their first thread, and then proceed to recycle some stupid DOS code they found on the net.
    rogster001 likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading a buffer line by line, while using system read
    By Hammad Saleem in forum C Programming
    Replies: 9
    Last Post: 05-27-2008, 06:41 AM
  2. Getting last system reboot time - C
    By Markallen85 in forum Windows Programming
    Replies: 3
    Last Post: 08-22-2003, 01:32 PM
  3. Reboot example
    By [SuRaNa] in forum C++ Programming
    Replies: 2
    Last Post: 12-04-2002, 05:00 PM
  4. Reboot
    By Commander in forum C Programming
    Replies: 6
    Last Post: 09-24-2001, 01:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21