Answer to Question #331575 in C++ for Will

Question #331575

Write a function to conduct input validation to secure the smallest buffer. You may call this function void SecurePasswordBuffer(const char *arg). 

1
Expert's answer
2022-04-20T15:34:40-0400









#include <iostream>
#include <string.h>
#include <cstdint>
#define BUF_SIZE 15//Example buffer size for secureBuf
using namespace std;
//Implement function ch
void SecurePasswordBuffer(const char*arg)
{
  //Save buffer dont't remember bufsize 15 (defined) use #define
  if(strlen(arg)>=BUF_SIZE)
  {
    printf("Error bufer\n");
    abort();//ABORT SIGNAL
  }
  else{
    printf("Normaly\n");
  }
}
int main()
{
   char bf[25];
   printf("Input to buffer:");
   scanf("%s",bf);
   SecurePasswordBuffer(bf);
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS