Created
September 28, 2015 10:15
-
-
Save josejuansanchez/4c4ceae0743a99de141a to your computer and use it in GitHub Desktop.
generate_short_values.c
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> | |
| int main(int argc, char *argv[]) | |
| { | |
| if (argc < 4) { | |
| printf("Usage: %s <initial_value> <increment> <#total>\n", argv[0]); | |
| return 1; | |
| } | |
| short initial_value = (short) atoi(argv[1]); | |
| short increment = (short) atoi(argv[2]); | |
| int total = atoi(argv[3]); | |
| FILE *f; | |
| f = fopen("samples.bytes", "wb"); | |
| short sample = initial_value; | |
| for(short i=0; i < total; i++) { | |
| fwrite(&sample, sizeof(short), 1, f); | |
| sample = sample + increment; | |
| } | |
| fclose(f); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment