-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
46 lines (35 loc) · 698 Bytes
/
Copy pathmain.c
File metadata and controls
46 lines (35 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
AI image generator using OpenAI API
- You need to change {OPEN_AI_API} in function.h
- Pouya Rahju: github.com/pouyarahju
*/
#include <stdio.h>
#include <string.h>
#include "functions.h"
int main(int argc, char *argv[])
{
FILE *fp;
char buffer[500];
/* check args */
if (argc < 2)
{
printf("Example to run a.exe data.txt");
return 1;
}
/* open data file */
fp = fopen(argv[1], "r");
if (!fp)
{
printf("Can't open this file.\n");
return 1;
}
/* Read data file */
while (fgets(buffer, 500, fp) != NULL)
{
buffer[strlen(buffer) - 1] = '\0';
printf("%s\n", buffer);
GenerateImage(buffer);
}
fclose(fp);
return 0;
}