Reroute where programs write to

This is a discussion on Reroute where programs write to within the C Programming forums, part of the General Programming Boards category; Hey, i'm in college and i work in the pc lab, but i have some long breaks between classes and ...

  1. #1
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378

    Reroute where programs write to

    Hey, i'm in college and i work in the pc lab, but i have some long breaks between classes and from when class ends til i have to work. The school has a policy with the computers that you can't modify them by installing software, etc. so i install whatever programs i may want to use to my flash drive, such as AIM, firefox, and Dev-C++. the only problem i have, is these programs want to write data to the C: drive and whenever the computers reboot, a network image is restored so anything saved to the hard drive dies. So i was wondering how difficult it would be to write a program that would catch these other programs trying to write to the hard drive and reroute it so itd write to the same folder location on my flash drive. So when i install a plugin for firefox, instead of it going to application data in my doc's on the C drive, itd go to application data in my doc's on my flash drive.
    thanks
    Registered Linux User #380033. Be counted: http://counter.li.org

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Well, for things like your Application Data folder, there's actually an environment variable called APPDATA for it. If you overrode it to point to your flash drive, that should accomplish what you're looking for.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    and to do this i would...

    ? lol thanks
    Registered Linux User #380033. Be counted: http://counter.li.org

  4. #4
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Open a dos prompt, and type 'help set'. That should get you started.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  5. #5
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    gotcha.

    so if i wanted it automated for everytime i put my flash drive in the pc, i'd just create a batch file on it to set the variable and run that before doing anything..?
    Registered Linux User #380033. Be counted: http://counter.li.org

  6. #6
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Yep.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  7. #7
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    easy enough.

    appdata.bat
    Code:
    @echo off
    set APPDATA=F:\Documents and Settings\Tim\Application Data
    exit
    Registered Linux User #380033. Be counted: http://counter.li.org

  8. #8
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    mm...it doesn't appear to be working.
    Registered Linux User #380033. Be counted: http://counter.li.org

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can I easily write multi-core programs in C?
    By advancedk in forum C Programming
    Replies: 2
    Last Post: 08-13-2008, 06:22 PM
  2. read write lock in C#
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 04-16-2008, 09:49 AM
  3. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 03:00 AM
  4. Some humour...
    By Stan100 in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 11-06-2003, 10:25 PM
  5. Calling DOS based programs
    By UnclePunker in forum C++ Programming
    Replies: 3
    Last Post: 08-07-2003, 10:37 AM

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