codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Looking to code something.  Gord T at 20:26 on Tuesday, November 21, 2006
 

Bored again. Need help with a utility? Joint efforts preferred. School exam/tests projects NOT. Windows win32 (VS 2005) enviroment preferred. MFC NOT. Math stuff is cool. Looking for an ongoing public(here) project where we all pitch in.
Actually school stuff is ok if it has a public benefit (non-profit). No web stuff. I have 1000? funtions/classes in my personal lib that I'm willing to share/use. Would just like to have fun coding a public project (here).
-Gord.

  Had some spare time.  Gord T at 14:34 on Thursday, November 23, 2006
 

Here’s a simple file encrypter-decrypter.
Run once to encrypt, once again to decrypt.
Written with Visual Studio 2005, Win32 console application.
//////////////////////////////////////////////////////////////////////
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once


#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <stdio.h>
#include <tchar.h>
//////////////////////////////////////////////////////////////////////
// stdafx.cpp : source file that includes just the standard includes
// EncryptFile.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

//////////////////////////////////////////////////////////////////////
// EncryptFile.cpp : Defines the entry point for the console application.
// A simple 1 byte encrypter/ decrypter.
//

#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
FILE *stream;
unsigned char data,key;
char user_input[80];;
errno_t error = 1; // 0 = OK
long file_pos;

key = 135;

memset(user_input,0,80);
cout << "Enter file name to encrypt...";
cin >> user_input;

if( (error = fopen_s( &stream,"/forum/ctemptest.txt", "r+b" )) !=0 )
{ printf( "The file 'crt_fopen_s.c' was not opened\n" );
cout << "Press any get" << endl;
cin >> user_input;
return 0;
}
cout << "wait...";
//run once to encrypt, once again to decrypt.

file_pos = 0;
while(1)
{
fseek(stream,file_pos,SEEK_SET);
if(!fread(&data,1,1,stream)) break;
data = data ^ key;
fseek(stream,file_pos,SEEK_SET);
fwrite(&data,1,1,stream);
file_pos++;
}

cout << "File encrypted. Press any key";
_getch();
fclose(stream);
}
//////////////////////////////////////////////////////////////////////


  Re: Looking to code something.  Gord T at 14:39 on Thursday, November 23, 2006
 

Oops, the line
printf( "The file 'crt_fopen_s.c' was not opened\n" );
should be
printf( "The file <%s> was not opened.\r\n", input );


<Added>

printf( "The file <%s> was not opened.\r\n",user_input );
That's it, it's official, I have CRT dyslexia lol.

<Added>

I'm thinking about unarchiving my doom2 code. I had been working on a win-doom port of it which has better graphic resolution and runs in 16 or 24 bit color. If anyone is interested, I'll give you my source code.
The dos version was written with 'Rhide' and the windows version with Visual c++ 5. I would like to convert the maps to polys and use direct x instead of code-rendering.Probably redone ground up. Just an idea.
-Gord.








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  AD Skyscrapers
•  Re: Using a Pipe | with a Variable Name!
•  adding audio to html page
•  How to web data base?
•  Re: For better design, please vote!
•  Where jpeg, tiff conventions?
•  Re: Looking to code something.
•  Re: Trying to create a C++ Object Oriented game
•  cant get iframe1 links to load into frame2 HELP please?


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2006