Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. thinICE80

    Sum two string variables

    Hi, anyone knows how to sum two string variables, I've tried with strcat but this function accept as the second parameter only a constant string. I want to do something like this: char var1[10], var2[10], var3[20]; var1 = strcpy(var1,"hewhwho"); var2 = strcpy(var2,"fhhgoehg"); var3 =...
  2. thinICE80

    Beginner: help with pointer and memory

    I tried this as input... #include <stdio.h> int main(int argc, char *argv[]) { char *input = (char *)malloc(1000*sizeof(char)); gets(input); printf("%s",input); } ...looks for me simpler and works fine, but dunno why compiler tells me that gets is a dangerous function and should not be...
  3. thinICE80

    Beginner: help with pointer and memory

    @ArkM Yes, I was thinking the same, someone from school say me to use read and write, but I noticed that these function are really out of scope. On the other hand using these I had to understand well pointers.
  4. thinICE80

    Beginner: help with pointer and memory

    I fix the room issue for ShellTxt, also if it does not creat problem. Thanks SamBones. @Trojan Yes, probably I overwrite the last char but is what I want, I think that the read function add also a \n to the buffer and don't close the string with \0. So "cmd[nByte-1]='\0';" overwright the \n...
  5. thinICE80

    Beginner: help with pointer and memory

    Thanks, works fine if I add \0 at nByte-1. cmd[nByte-1]='\0';
  6. thinICE80

    Beginner: help with pointer and memory

    I wrote this, works nearly as expected but on the last element extracted from input string it attach various unexpected character, please any suggestion?? In particular look at divCmd function. #include <stdio.h> #include <unistd.h> #include <string.h> #define BUFLEN 1024 #define STDIN 0...

Part and Inventory Search

Back
Top