filename change in c++
I want to do a piece os software which encrypts and decrypts filenames... and I ddn't find anyhting simple and basic in linux...
so I started with a simple c++++ program using ftream etc etc.. however I didn't find a function to edit the filename of a file.. I tried therefore to copy a video content to another with this program but the program hangs??? why??? Code:
|
Probably want to read an encrypted file as binary, and the way it's read.
Read the entire file as something like; Code:
#include <fstream> Code:
while (!in.eof()) { |
operator >> discards the end of line character.. which in a binary file such as avi, is actual data.. so do not use it even in binary mode..
do as -X- suggested and open in binary mode and then you can use read and write inside your while loop.. read and write are the standard way to handle binary files.. you need to read up on fstream and see how file streams are handled.. that should make things clearer. |
thanks it works!!! this is my final code for those wo will read the post
Code:
|
#include <cstdio>
rename("old","new"); Not a big thing, you don't need the .c_str(), ... but you should specify the binary flag. |
thank you so much..
I figured it out and now it works... could you help me for the last part of the program? How do I encrypt a string (the filename)??? is there a standard c++ library which does it??? because I couldn't find it.. thanks so much Now I watch the olimpic games :-P |
Code:
#include <fstream> |
All times are GMT -5. The time now is 01:37 AM. |