*.dat file creation

This is a discussion on *.dat file creation within the C Programming forums, part of the General Programming Boards category; How can I convert a *.bat file in dos into a *.dat file and then get it to activate from ...

  1. #1
    Registered User Robert_Ingleby's Avatar
    Join Date
    Oct 2001
    Posts
    57

    *.dat file creation

    How can I convert a *.bat file in dos into a *.dat file and then get it to activate from my c program.

    As it is the *.bat is being ativated by the system() command but I want to encrypt the bat file to a dat file so the user is unable to read it.

    Can this be done and how?

  2. #2
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    why?

  3. #3
    Registered User Robert_Ingleby's Avatar
    Join Date
    Oct 2001
    Posts
    57
    Because the Bat file in question took 2 weeks to write and contains stuff that is secret that I dont want someone else playing with or ripping off.

    Can it be done???????????????

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    And the C program should run the code in the dat-file? Why not rewrite the code in C?

  5. #5
    Unregistered
    Guest

    Lightbulb

    u could use some sort of file encription in c to encode a .bat file to a .dat then when they run the program it decodes the file runs it then delets it. but depending on how long it takes to exicute or if it gets user input they might be able to read the .bat file still

  6. #6
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    decrypt the file and store it in memory, then run it using the system() command.

  7. #7
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    Eh, just either re-write the thing in C (as was stated), OR...

    just whip up a quick program to read in a file, go through the buffer, and add 1 to each slot in the array (excluding newlines, I should think). Then have the program write it back out as a dat file...In your main program, ship the .dat file with it, and have some code to read in the .dat file, decrypt (subtracting 1 to everything), and use a system() call using the decrypted buffer. Don't know if that'd work though, if it doesn't then have it write a temporary decrypted file and run it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  3. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  4. how to convert a text file to a .dat file
    By Linette in forum C++ Programming
    Replies: 11
    Last Post: 02-25-2002, 04:58 AM
  5. Simple File Creation Algorithm
    By muffin in forum C Programming
    Replies: 13
    Last Post: 08-24-2001, 03:28 PM

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