Thread: Encryption using bitwise operator in C

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    If you use flp1969's example including the sample command line snippet, it's not supposed to display anything to screen. Did you check the files?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    Registered User
    Join Date
    Mar 2019
    Posts
    51
    Quote Originally Posted by laserlight View Post
    You shouldn't open three files at once when you only need two at that time: the first for reading and the second for writing. After closing those two files, when you need to open the second file again for reading, you can then do that.

    Also, ch is still a char when it should be an int, as mentioned by Click_here in post #3.

    And honestly, just call it "encryption" if you will. As I noted in post #8, in a cryptographic context, the use of "code" and "encoding" here is inappropriate as it refers to a different though related concept: it is a simple substitution cipher, as exceedingly simple as it may be.
    Quote Originally Posted by laserlight View Post
    You shouldn't open three files at once when you only need two at that time: the first for reading and the second for writing. After closing those two files, when you need to open the second file again for reading, you can then do that.

    Also, ch is still a char when it should be an int, as mentioned by Click_here in post #3.

    And honestly, just call it "encryption" if you will. As I noted in post #8, in a cryptographic context, the use of "code" and "encoding" here is inappropriate as it refers to a different though related concept: it is a simple substitution cipher, as exceedingly simple as it may be.
    OK. I actually tried this program with another way too by opening two files i.e. fp and ft then closing both and removing the fp and then renaming the ft as fp. But in this process I was not being able to observe all three files status.

  3. #18
    Registered User
    Join Date
    Mar 2019
    Posts
    51
    Quote Originally Posted by laserlight View Post
    If you use flp1969's example including the sample command line snippet, it's not supposed to display anything to screen. Did you check the files?
    Yup! files are in same status as I have shown in post # 10

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using bitwise operator to see if x>y
    By Lina_inverse in forum C Programming
    Replies: 33
    Last Post: 09-23-2012, 07:16 PM
  2. Replies: 6
    Last Post: 03-08-2012, 05:37 PM
  3. bitwise operator
    By donkey_C in forum C Programming
    Replies: 7
    Last Post: 09-26-2010, 02:47 PM
  4. Bitwise Operator Help
    By ggraz in forum C Programming
    Replies: 2
    Last Post: 09-28-2008, 09:20 AM
  5. bitwise operator
    By ssharish2005 in forum C Programming
    Replies: 8
    Last Post: 09-30-2005, 01:17 AM

Tags for this Thread