how do can search for plaintext files within a directory and then encrypt them using shift cipher? [on hold]
Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
- It should print on the terminal, the names of all the files within the same directory and indicate the state of each file (each one on a separate line). The state can be ‘ASCII' or ‘Undefined’. Assume ASCII is 7 bits.
- All ASCII files should be encrypted using shift cipher and the provided key . The result of each encryption should be saved to a new file called
filename.cipher
Here is what I have tried
#include <stdio.h>
#include <dirent.h>
int main(void)
struct dirent *de; // Pointer for directory entry
// opendir() returns a pointer of DIR type.
DIR *dr = opendir(".");
if (dr == NULL) // opendir returns NULL if couldn't open directory
printf("Could not open current directory" );
return 0;
// for readdir()
while ((de = readdir(dr)) != NULL)
printf("%sn", de->d_name);
closedir(dr);
return 0;
c c++
New contributor
put on hold as unclear what you're asking by Scott, muru, Gilles, Romeo Ninov, Michael Homer Nov 20 at 8:46
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
|
show 3 more comments
up vote
-1
down vote
favorite
- It should print on the terminal, the names of all the files within the same directory and indicate the state of each file (each one on a separate line). The state can be ‘ASCII' or ‘Undefined’. Assume ASCII is 7 bits.
- All ASCII files should be encrypted using shift cipher and the provided key . The result of each encryption should be saved to a new file called
filename.cipher
Here is what I have tried
#include <stdio.h>
#include <dirent.h>
int main(void)
struct dirent *de; // Pointer for directory entry
// opendir() returns a pointer of DIR type.
DIR *dr = opendir(".");
if (dr == NULL) // opendir returns NULL if couldn't open directory
printf("Could not open current directory" );
return 0;
// for readdir()
while ((de = readdir(dr)) != NULL)
printf("%sn", de->d_name);
closedir(dr);
return 0;
c c++
New contributor
put on hold as unclear what you're asking by Scott, muru, Gilles, Romeo Ninov, Michael Homer Nov 20 at 8:46
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Good to see what you have tried. Can you tell us a little more about what you are trying to do? And does it have to be inC
?
– ctrl-alt-delor
Nov 20 at 8:08
You have more than one question here. You seem to be stuck on iterating through the files.
– ctrl-alt-delor
Nov 20 at 10:06
Do one thing at a time. What is the next useful thing that the program could do? You seem to be stuck on iterating through the files. Write a program that does this, and displays the names, and test it. Then ask “what is the next useful thing that this program should do?” etc etc
– ctrl-alt-delor
Nov 20 at 10:08
The question is clear, but there are too many. (one question per question)
– ctrl-alt-delor
Nov 20 at 10:09
The next step is to open each file and read every character and check if any character has its 8th bit on. Do you know how to start that?
– Mark Plotnick
Nov 20 at 12:19
|
show 3 more comments
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
- It should print on the terminal, the names of all the files within the same directory and indicate the state of each file (each one on a separate line). The state can be ‘ASCII' or ‘Undefined’. Assume ASCII is 7 bits.
- All ASCII files should be encrypted using shift cipher and the provided key . The result of each encryption should be saved to a new file called
filename.cipher
Here is what I have tried
#include <stdio.h>
#include <dirent.h>
int main(void)
struct dirent *de; // Pointer for directory entry
// opendir() returns a pointer of DIR type.
DIR *dr = opendir(".");
if (dr == NULL) // opendir returns NULL if couldn't open directory
printf("Could not open current directory" );
return 0;
// for readdir()
while ((de = readdir(dr)) != NULL)
printf("%sn", de->d_name);
closedir(dr);
return 0;
c c++
New contributor
- It should print on the terminal, the names of all the files within the same directory and indicate the state of each file (each one on a separate line). The state can be ‘ASCII' or ‘Undefined’. Assume ASCII is 7 bits.
- All ASCII files should be encrypted using shift cipher and the provided key . The result of each encryption should be saved to a new file called
filename.cipher
Here is what I have tried
#include <stdio.h>
#include <dirent.h>
int main(void)
struct dirent *de; // Pointer for directory entry
// opendir() returns a pointer of DIR type.
DIR *dr = opendir(".");
if (dr == NULL) // opendir returns NULL if couldn't open directory
printf("Could not open current directory" );
return 0;
// for readdir()
while ((de = readdir(dr)) != NULL)
printf("%sn", de->d_name);
closedir(dr);
return 0;
c c++
c c++
New contributor
New contributor
edited Nov 20 at 11:04
New contributor
asked Nov 20 at 7:07
Jordan
62
62
New contributor
New contributor
put on hold as unclear what you're asking by Scott, muru, Gilles, Romeo Ninov, Michael Homer Nov 20 at 8:46
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as unclear what you're asking by Scott, muru, Gilles, Romeo Ninov, Michael Homer Nov 20 at 8:46
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Good to see what you have tried. Can you tell us a little more about what you are trying to do? And does it have to be inC
?
– ctrl-alt-delor
Nov 20 at 8:08
You have more than one question here. You seem to be stuck on iterating through the files.
– ctrl-alt-delor
Nov 20 at 10:06
Do one thing at a time. What is the next useful thing that the program could do? You seem to be stuck on iterating through the files. Write a program that does this, and displays the names, and test it. Then ask “what is the next useful thing that this program should do?” etc etc
– ctrl-alt-delor
Nov 20 at 10:08
The question is clear, but there are too many. (one question per question)
– ctrl-alt-delor
Nov 20 at 10:09
The next step is to open each file and read every character and check if any character has its 8th bit on. Do you know how to start that?
– Mark Plotnick
Nov 20 at 12:19
|
show 3 more comments
Good to see what you have tried. Can you tell us a little more about what you are trying to do? And does it have to be inC
?
– ctrl-alt-delor
Nov 20 at 8:08
You have more than one question here. You seem to be stuck on iterating through the files.
– ctrl-alt-delor
Nov 20 at 10:06
Do one thing at a time. What is the next useful thing that the program could do? You seem to be stuck on iterating through the files. Write a program that does this, and displays the names, and test it. Then ask “what is the next useful thing that this program should do?” etc etc
– ctrl-alt-delor
Nov 20 at 10:08
The question is clear, but there are too many. (one question per question)
– ctrl-alt-delor
Nov 20 at 10:09
The next step is to open each file and read every character and check if any character has its 8th bit on. Do you know how to start that?
– Mark Plotnick
Nov 20 at 12:19
Good to see what you have tried. Can you tell us a little more about what you are trying to do? And does it have to be in
C
?– ctrl-alt-delor
Nov 20 at 8:08
Good to see what you have tried. Can you tell us a little more about what you are trying to do? And does it have to be in
C
?– ctrl-alt-delor
Nov 20 at 8:08
You have more than one question here. You seem to be stuck on iterating through the files.
– ctrl-alt-delor
Nov 20 at 10:06
You have more than one question here. You seem to be stuck on iterating through the files.
– ctrl-alt-delor
Nov 20 at 10:06
Do one thing at a time. What is the next useful thing that the program could do? You seem to be stuck on iterating through the files. Write a program that does this, and displays the names, and test it. Then ask “what is the next useful thing that this program should do?” etc etc
– ctrl-alt-delor
Nov 20 at 10:08
Do one thing at a time. What is the next useful thing that the program could do? You seem to be stuck on iterating through the files. Write a program that does this, and displays the names, and test it. Then ask “what is the next useful thing that this program should do?” etc etc
– ctrl-alt-delor
Nov 20 at 10:08
The question is clear, but there are too many. (one question per question)
– ctrl-alt-delor
Nov 20 at 10:09
The question is clear, but there are too many. (one question per question)
– ctrl-alt-delor
Nov 20 at 10:09
The next step is to open each file and read every character and check if any character has its 8th bit on. Do you know how to start that?
– Mark Plotnick
Nov 20 at 12:19
The next step is to open each file and read every character and check if any character has its 8th bit on. Do you know how to start that?
– Mark Plotnick
Nov 20 at 12:19
|
show 3 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Good to see what you have tried. Can you tell us a little more about what you are trying to do? And does it have to be in
C
?– ctrl-alt-delor
Nov 20 at 8:08
You have more than one question here. You seem to be stuck on iterating through the files.
– ctrl-alt-delor
Nov 20 at 10:06
Do one thing at a time. What is the next useful thing that the program could do? You seem to be stuck on iterating through the files. Write a program that does this, and displays the names, and test it. Then ask “what is the next useful thing that this program should do?” etc etc
– ctrl-alt-delor
Nov 20 at 10:08
The question is clear, but there are too many. (one question per question)
– ctrl-alt-delor
Nov 20 at 10:09
The next step is to open each file and read every character and check if any character has its 8th bit on. Do you know how to start that?
– Mark Plotnick
Nov 20 at 12:19