Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. void inputParsing(char *src, char *end, char *destU, char *destP) {
  6. int x = 0;
  7. for(; src != end; src++){
  8. if((*src != '+') && x==0) {
  9. *destU = *src;
  10. destU++;
  11. }
  12. else if((*src != '+') && x==1){
  13. *destP = *src;
  14. destP++;
  15. }
  16. else {
  17. x = 1;
  18. }
  19. }
  20. *destU = ' '; //What does this line do?
  21. *destP = ' '; //What does this line do?
  22. *++destU = '0'; //What does this line do?
  23. *++destP = '0'; //What does this line do?
  24. printf("%sn",&destU);
  25. printf("%sn",&destP);
  26. }
  27.  
  28. void inputStoring() {
  29. char inputArray[200];
  30. char usernameArray[200];
  31. char passwordArray[200];
  32. //int n = atoi(getenv("CONTENT_LENGTH"));
  33. //fgets(inputArray, n+1, stdin);
  34. strcpy(inputArray, "gaming+koko");
  35. int n = strlen(inputArray);
  36. inputParsing(inputArray, inputArray + n, usernameArray, passwordArray); //inputArray+n is referencing the array cell that contains the last inputted character.
  37. }
  38.  
  39. int main(void) {
  40. inputStoring();
  41. }
  42.  
  43. *++destU = ''; //What does this line do?
  44. *++destP = ''; //What does this line do?
  45. printf("%sn",destU);
  46. printf("%sn",destP);
  47.  
  48. printf("%sn",destU);
  49. printf("%sn",destP);
  50.  
  51. *destU = ' '; /*Sets "space character" or ' ' at the current destU pointer position*/
  52. *destP = ' '; /*Same but for destP*/
  53. *++destU = '0'; /*Moves pointer position by 1 place forward and sets a value 0 byte in its place - this is not a string terminating value ( is) so u may have problems when trying to print the string thank you EOF for correcting*/
  54. *++destP = '0'; /*Same but for destP*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement