Thread: Saving Data

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    8

    Saving Data

    I'm trying to write a program that keeps data on people. The data is to be stored on the hard disk for future reference. The only way i know how to do this is to a txt file and this is not particularly secure. I fanyone knows of a better way could they please let me know what it is and how to do it
    Joe

  2. #2
    Registered User
    Join Date
    Feb 2006
    Posts
    312
    You could use some sort of encryption algorithm to make the data unreadable. There are plenty around, so do a google search

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Well, it all depends on how hard you want to make it for crackers. Anywhere from the simple base64 or ROT13 to XOR up to PGP are options galore.

    ...this isn't for some malware thing, is it?
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  4. #4
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    85
    why not just store it as a binary file?

  6. #6
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    If you don't expect your users to be too advanced, there's always the Registry.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. singly linked circular list
    By DarkDot in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2007, 08:55 PM
  3. saving data into a file
    By afrm in forum C Programming
    Replies: 4
    Last Post: 05-22-2006, 09:54 AM
  4. C diamonds and perls :°)
    By Carlos in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-16-2003, 10:19 PM
  5. Saving data
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 08-01-2002, 08:36 PM