Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /*
- Typical use:
- PScriptGen 256 SPK SPKC FP WB _CH
- This will generate lines like:
- SPK001,SPKC001,FP001,WB001,_CH001
- SPK002,SPKC002,FP002,WB002,_CH002
- SPK003,SPKC003,FP003,WB003,_CH003
- */
- FILE *file;
- char *filename = "c:\\PlexonData\\plexutilbatch.txt";
- int main(int argc, char *argv[])
- {
- if (argc < 4 || argc > 7)
- {
- printf("Not enough arguments, or too many arguments.\n");
- return 0;
- }
- file = fopen(filename, "w");
- if (file == NULL)
- {
- printf("File couldn't open\n");
- }
- int channels = atoi(argv[1]);
- int fields = argc - 2;
- int x, y;
- //Ok, here we go.
- for (x = 0; x < channels; x++)
- {
- for (y = 0; y < fields ; y++)
- {
- fprintf(file, "%s%03d",argv[y + 2], x + 1);
- if (y < fields - 1)
- {
- fprintf(file, ", ");
- }
- }
- fprintf(file, "\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement