strcat

Why does MSVC++ consider "std::strcat" to be "unsafe"? (C++)

When I try to do things like this: char* prefix = "Sector_Data\\sector"; char* s_num = "0"; std::strcat(prefix, s_num); std::strcat(prefix, "\\"); and so on and so forth, I get a warning warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. Why is strcat considered unsafe, and is there a...

string concatenate char* with LPCTSTR

LPCTSTR Machine=L"Network\\Value"; char s[100]="Computer\\"; strcat(s,(const char*)Machine); printf("%s",s); Here i received output Computer\N only i expect output like Computer\Network\Value . Give Solution for that.. ...

Matlab strcat function troubles with spaces

I'm trying to accomplish this: strcat('red ', 'yellow ', 'white ') I expected to see "red yellow white", however, I see "redyellowwhite" on the command output. What needs to be done to ensure the spaces are concatenated properly? Thanks in advance. ...

strcat query (string.h)

First off : STRCAT : Cplusplus - strcat When clearly the definition says : char * strcat ( char * destination, const char * source ); Why'd they use char str[80] in the example??? Shouldn't they have used a character pointer? ...

Strange characters appear when using strcat function in C++

I am a newbie to C++ and learning from the MSDN C++ Beginner's Guide. While trying the strcat function it works but I get three strange characters at the beginning. Here is my code #include <iostream> #include <cstdio> #include <cstring> using namespace std; int main() { char first_name[40],last_name[40],full_name[80],space[1]; ...

C char to string (passing char to strcat())

hi all, my problem is in convert a char to string i have to pass to strcat() a char to append to a string, how can i do? thanks! #include <stdio.h> #include <string.h> char *asd(char* in, char *out){ while(*in){ strcat(out, *in); // <-- err arg 2 makes pointer from integer without a cast *in++; } return out;...

strcat implementation

I tried to implement the strcat by myself, and I found the strcat implementation from Wiki like this......but when I use it, there is segmentation fault. What's wrong with the code below? char * strcat(char *dest, const char *src) { size_t i,j; for (i = 0; dest[i] != '\0'; i++) ; for (j = 0; src[j] != '\0'; j++) ...

Segmentation Fault with strcat

Hi, I'm having a bit of a problem with strcat and segmentation faults. The error is as follows: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000 0x00007fff82049f1f in __strcat_chk () (gdb) where #0 0x00007fff82049f1f in __strcat_chk () #1 0x0000000100000adf i...

What is the scope of a char*[] in C?

I have some code that does the following: while(some condition) { char *line[WORDLEN]; //do stuff to line, including strcat(line, "words") printf("%s", line); line[0] = '\0'; } However, it seems like line[0] = '\0' is not doing what I am hoping it will do. I want to go back through the loop, and use line as though ...

AIX 5.3 vs Solaris 5.10 - C strcat implementation

Does anyone have any idea of why this could happen? I have a C program in AIX 5.3, I've been asked to run it on a SPARC Solaris 10 machine, but when I did it, I noticed there was a buffer overflow with one of the many reckless strcat uses. My goal is not to sanitize the code but to provide a concrete and well founded answer of why does...

How does return of pointer work in strcat()

Hey guys I'm trying to figure how pointers are returned by strcat(), so I tried implementing my own strcat() to see how it works. The following is my code for mystrcat(), which works like the real strcat(): char *mystrcat(char *destination, char *source) { char *str = destination; while (*str != '\0') { str++; }...