Answer the question
In order to leave comments, you need to log in
Read file block by block?
Here is the code you are looking for
FILE *fp,*fencrypted,*fdecrypted;
char str[N];
if ((fp=fopen("message.txt", "r" ))==NULL) {
//printf("Cannot open file.\n");
std::cout<<"Cannot open file.\n";
exit (1);
}
std::vector<uint64_t> *msg = new std::vector<uint64_t>(),
*plaintext = new std::vector<uint64_t>();//plain text
unsigned long long id;
while(!feof (fp)) {
for (int i = 0; i<N; i++)
str[i] = '\0';
if (fgets(str, N, fp))
{
//printf("%s", str);
std::cout<<str;
memcpy(&id, str, N);
msg->push_back(id);
}
Business process, activities that produce a specific service or product for customers
Business process modeling, activity of representing processes of an enterprise in order
Manufacturing process management, a collection of technologies and methods used to define.
Process architecture, structural design of processes, applies to fields such as computers.
Process costing, a cost allocation procedure of managerial accounting
Process management, ensemble of activities of planning and monitoring the performance of .
Process management (Project Management) , a systematic series of activities directed .
Process-based management, is a management approach that views a business as a collection .
Process industry, a category of material-related industry.
Answer the question
In order to leave comments, you need to log in
Changed the code to fgetc seems to work
char ch;
int countbyte = 0;
while ((ch = fgetc(fp)) != -1)
{
if (countbyte % 8 == 0 && countbyte!=0)
{
countbyte = 0;
std::cout << str;
memcpy(&id, str, N);
msg->push_back(id);
for (int i = 0; i<N; i++)
str[i] = '\0';
}
str[countbyte] = ch;
countbyte++;
}
memcpy(&id, str, N);
msg->push_back(id);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question