Du bist nicht angemeldet.
![]() |
Quellcode |
1 2 3 4 |
void encryptFile(CString fname) { FILE * stream; } |
![]() |
Quellcode |
1 2 3 4 5 |
char encrypt(char x) { int y = x + 13; if (y > 255) y -= 256; return (char) y; } |
![]() |
Quellcode |
1 2 3 4 5 |
char decrypt(char x) { int y = x - 13; if (y < 0) y += 256; return (char) y; } |
![]() |
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
void encryptFile(CString fname) { FILE * stream; CString text = ""; char buffer[1]; int i, ch; /* Open file to read line from: */ if( (stream = fopen( "C:\\test.txt", "r" )) == NULL ) exit( 0 ); ch = fgetc( stream ); for( i=0; ( feof( stream ) == 0 ); i++ ) { buffer[0] = (char)ch; ch = fgetc( stream ); text = text + buffer; } fclose( stream ); if( (stream = fopen( "C:\\test.txt", "w" )) == NULL ) exit( 0 ); for( i = 0; i < text.GetLen(); i++) fputc( text[i], stream ); fclose( stream ); } |
![]() |
Quellcode |
1 |
Das ist ein Test! |
![]() |
Quellcode |
1 |
DÌÌ̈ÀaÌÌÌÀ‡ÀsÌÌÌÀ‡À ÌḬ̀‡ÀiÌḬ̀‡ÀsÌḬ̀‡ÀtÌÌÌ ‡À ÌÌÌ ‡ÀeÌÌ̇ÀiÌÌ̇ÀnÌÌÌ€‡À ÌÌÌ€‡ÀTÌÌÌp‡ÀeÌÌÌp‡ÀsÌÌÌp‡ÀtÌÌÌ`‡À!ÌÌÌ`‡À |
Zitat
void encryptFile(CString fname)
{
FILE * stream;
CString text = "";
char buffer[1];
int i, ch;
/* Open file to read line from: */
if( (stream = fopen( "C:\\test.txt", "r" )) == NULL )
exit( 0 );
ch = fgetc( stream );
for( i=0; ( feof( stream ) == 0 ); i++ )
{
buffer[0] = (char)ch;
ch = fgetc( stream );
text = text + buffer[0];
}
fclose( stream );
if( (stream = fopen( "C:\\test.txt", "w" )) == NULL )
exit( 0 );
for( i = 0; i < text.GetLen(); i++)
fputc( text, stream );
fclose( stream );
}
![]() |
Quellcode |
1 2 3 4 |
while(!feof(stream)) { text += fgetc(stream); } |
mindheat
Senior Member
-