This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*--------------------------------------------------------- | |
| * Program: shuffle.cpp | |
| * Usage: ./shuffle | |
| *--------------------------------------------------------- | |
| * Description: Prints a random permutation of the string | |
| * "helloworld" alongside the source string | |
| *_________________________________________________________ | |
| */ | |
| /* INCLUDES */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*--------------------------------------------------------- | |
| * Program: recshuffle.cpp | |
| * Usage: ./recshuffle | |
| *--------------------------------------------------------- | |
| * Description: Prints a random permutation of the string | |
| * "helloworld" alongside the source string. This program | |
| * uses a recursive approach instead of an iterative one | |
| *_________________________________________________________ | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // extract query from request-target | |
| const char* temp = qextract(line); | |
| int len = strlen(temp); | |
| char query[len+1]; | |
| // make a usable copy of query | |
| strncpy(query, temp,len+1); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const char* qextract(char* line) { | |
| //get target line with query in it | |
| const char* target = textract(line, 0); | |
| int len = strlen(target); | |
| char mtarget[len+1]; | |
| // make a more mallible copy | |
| memcpy(mtarget, target,len); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <unistd.h> | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| int main(int argc, char* argv[]){ | |
| char buffer; //number of bits copied at once | |
| FILE* source = fopen(argv[1],"r"); | |
| FILE* dest = fopen(argv[2],"w"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| int main(int argc, char* argv[]){ | |
| //buffer array | |
| char buffer[120]; | |
| //array for the package name |
NewerOlder