B
blackneos940
Guest
So anyway, we all know that you can append things to the end of Files in Python, like this little example here from my SA2B_Checklist Program..... :3
But how do we do it in C.....? :< I do
it throws me a "Segmentation Fault" error when I try and run it..... :< What's up with that....?
Thanks for any help, guys....... :3
Code:
animal_name = input("Type the Animal's name now:\n>>> ").capitalize()
with open(file_name + ".txt", "wb") as le_output:
#Following Code goes HERE. :3
But how do we do it in C.....? :< I do
Code:
#include <stdio.h>
#include <stdlib.h>
#define PI 3.14
int main(void)
{
int file_name;
printf ("Want to make a File?\nType a File Name now. :)\n");
scanf ("%d", &file_name);
FILE *f_ptr = fopen (file_name + ".txt", "w");
if (f_ptr == NULL)
{
printf ("Could not write to file.\n");
}
fprintf (f_ptr, "Hello World!!\n");
fflush (f_ptr);
fclose (f_ptr);
/*Rest of Program goes here*/
it throws me a "Segmentation Fault" error when I try and run it..... :< What's up with that....?
