Skip to main content
edited body
Source Link
Dexter Thorn
  • 2.2k
  • 2
  • 22
  • 37

I have written a little program that overwrites memory. It creates useless files in a folder named "folder" (I am so creative). The purpose is to overwrite old data. It's not a very professional program because I am a beginner, but I think it should do for which it is destined: exhaust memory and thus maybe overwrite old data that was stored on it. If you have tips for me how to imrove this program or how to make it faster in it's execution I would be thankful!

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int create_files(int number_of_files, int number_of_values);

int main()
{
    srand(time(NULL));
int number_of_files;
    int number_of_files;number_of_values;
    int number_of_values;
    srand(time(NULL));

    printf("before using this program create a folder with the name \"folder\"\nin the same folder this program is located\n");
    printf("number of files: ");
    scanf("%d", &number_of_files);
    printf("number of values: ");
    scanf("%d", &number_of_values);
    
    create_files(number_of_files, number_of_values);
    
}

void create_files(int number_of_files, int number_of_values)
{   
    for(int i = 0; i < number_of_files; i++)
    {
        FILE * file;
        char file_name[30] = "./folder/";
        char file_number[20];
        sprintf(file_number, "%d", i);
        strcat(file_name, file_number);
        file = fopen(file_name, "w+");
        
        for(int j = 0; j < number_of_values; j++)
        {
            int random_value = rand();
            fprintf(file, "%d", random_value);
        }
        fclose(file);
    }
}

I have written a little program that overwrites memory. It creates useless files in a folder named "folder" (I am so creative). The purpose is to overwrite old data. It's not a very professional program because I am a beginner, but I think it should do for which it is destined: exhaust memory and thus maybe overwrite old data that was stored on it. If you have tips for me how to imrove this program or how to make it faster in it's execution I would be thankful!

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int create_files(int number_of_files, int number_of_values);

int main()
{
    srand(time(NULL));

    int number_of_files;
    int number_of_values;
    
    printf("before using this program create a folder with the name \"folder\"\nin the same folder this program is located\n");
    printf("number of files: ");
    scanf("%d", &number_of_files);
    printf("number of values: ");
    scanf("%d", &number_of_values);
    
    create_files(number_of_files, number_of_values);
    
}

void create_files(int number_of_files, int number_of_values)
{   
    for(int i = 0; i < number_of_files; i++)
    {
        FILE * file;
        char file_name[30] = "./folder/";
        char file_number[20];
        sprintf(file_number, "%d", i);
        strcat(file_name, file_number);
        file = fopen(file_name, "w+");
        
        for(int j = 0; j < number_of_values; j++)
        {
            int random_value = rand();
            fprintf(file, "%d", random_value);
        }
        fclose(file);
    }
}

I have written a little program that overwrites memory. It creates useless files in a folder named "folder" (I am so creative). The purpose is to overwrite old data. It's not a very professional program because I am a beginner, but I think it should do for which it is destined: exhaust memory and thus maybe overwrite old data that was stored on it. If you have tips for me how to imrove this program or how to make it faster in it's execution I would be thankful!

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int create_files(int number_of_files, int number_of_values);

int main()
{
    int number_of_files;
    int number_of_values;
    
    srand(time(NULL));

    printf("before using this program create a folder with the name \"folder\"\nin the same folder this program is located\n");
    printf("number of files: ");
    scanf("%d", &number_of_files);
    printf("number of values: ");
    scanf("%d", &number_of_values);
    
    create_files(number_of_files, number_of_values);
    
}

void create_files(int number_of_files, int number_of_values)
{   
    for(int i = 0; i < number_of_files; i++)
    {
        FILE * file;
        char file_name[30] = "./folder/";
        char file_number[20];
        sprintf(file_number, "%d", i);
        strcat(file_name, file_number);
        file = fopen(file_name, "w+");
        
        for(int j = 0; j < number_of_values; j++)
        {
            int random_value = rand();
            fprintf(file, "%d", random_value);
        }
        fclose(file);
    }
}
deleted 15 characters in body
Source Link
Dexter Thorn
  • 2.2k
  • 2
  • 22
  • 37

I have written a little program that overwrites memory. It creates useless files in a folder named "folder" (I am so creative). The purpose is to overwrite old data. It's not a very professional program because I am a beginner, but I think it should do for which it is destined: exhaust memory and thus maybe overwrite old data that was stored on it. If you have tips for me how to imrove this program or how to make it faster in it's execution I would be thankful!

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int create_files(int number_of_files, int number_of_values);

int main()
{
    int i;srand(time(NULL));

    int number_of_files;
    int number_of_values;
    
    printf("before using this program create a folder with the name \"folder\"\nin the same folder this program is located\n");
    printf("number of files: ");
    scanf("%d", &number_of_files);
    printf("number of values: ");
    scanf("%d", &number_of_values);
    
    create_files(number_of_files, number_of_values);
    
}

intvoid create_files(int number_of_files, int number_of_values)
{
    srand(time(NULL));
    
    for(int i = 0; i < number_of_files; i++)
    {
        FILE * file;
        char file_name[30] = "./folder/";
        char file_number[20];
        sprintf(file_number, "%d", i);
        strcat(file_name, file_number);
        file = fopen(file_name, "w+");
        
        for(int j = 0; j < number_of_values; j++)
        {
            int random_value = rand();
            fprintf(file, "%d", random_value);
        }
        fclose(file);
    }
}

I have written a little program that overwrites memory. It creates useless files in a folder named "folder" (I am so creative). The purpose is to overwrite old data. It's not a very professional program because I am a beginner, but I think it should do for which it is destined: exhaust memory and thus maybe overwrite old data that was stored on it. If you have tips for me how to imrove this program or how to make it faster in it's execution I would be thankful!

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int create_files(int number_of_files, int number_of_values);

int main()
{
    int i;
    int number_of_files;
    int number_of_values;
    
    printf("before using this program create a folder with the name \"folder\"\nin the same folder this program is located\n");
    printf("number of files: ");
    scanf("%d", &number_of_files);
    printf("number of values: ");
    scanf("%d", &number_of_values);
    
    create_files(number_of_files, number_of_values);
    
}

int create_files(int number_of_files, int number_of_values)
{
    srand(time(NULL));
    
    for(int i = 0; i < number_of_files; i++)
    {
        FILE * file;
        char file_name[30] = "./folder/";
        char file_number[20];
        sprintf(file_number, "%d", i);
        strcat(file_name, file_number);
        file = fopen(file_name, "w+");
        
        for(int j = 0; j < number_of_values; j++)
        {
            int random_value = rand();
            fprintf(file, "%d", random_value);
        }
        fclose(file);
    }
}

I have written a little program that overwrites memory. It creates useless files in a folder named "folder" (I am so creative). The purpose is to overwrite old data. It's not a very professional program because I am a beginner, but I think it should do for which it is destined: exhaust memory and thus maybe overwrite old data that was stored on it. If you have tips for me how to imrove this program or how to make it faster in it's execution I would be thankful!

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int create_files(int number_of_files, int number_of_values);

int main()
{
    srand(time(NULL));

    int number_of_files;
    int number_of_values;
    
    printf("before using this program create a folder with the name \"folder\"\nin the same folder this program is located\n");
    printf("number of files: ");
    scanf("%d", &number_of_files);
    printf("number of values: ");
    scanf("%d", &number_of_values);
    
    create_files(number_of_files, number_of_values);
    
}

void create_files(int number_of_files, int number_of_values)
{   
    for(int i = 0; i < number_of_files; i++)
    {
        FILE * file;
        char file_name[30] = "./folder/";
        char file_number[20];
        sprintf(file_number, "%d", i);
        strcat(file_name, file_number);
        file = fopen(file_name, "w+");
        
        for(int j = 0; j < number_of_values; j++)
        {
            int random_value = rand();
            fprintf(file, "%d", random_value);
        }
        fclose(file);
    }
}
added 9 characters in body
Source Link
Dexter Thorn
  • 2.2k
  • 2
  • 22
  • 37

I have written a little program that overwrites memory. It creates useless files in a folder named "folder" (I am so creative). The purpose is to overwrite old data. It's not a very professional program because I am a beginner, but I think it should do for which it is destined: exhaust memory and thus maybe overwrite old data that was stored on it. If you have tips for me how to imrove this program or how to make it faster in it's execution I would be thankful!

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int create_files(int number_of_files, int number_of_values);

int main()
{
    int i;
    int number_of_files;
    int number_of_values;
    
    printf("before using this program create a folder namedwith \"files\"\ninthe name \"folder\"\nin the same folder this program is located\n");
    printf("number of files: ");
    scanf("%d", &number_of_files);
    printf("number of values: ");
    scanf("%d", &number_of_values);
    
    create_files(number_of_files, number_of_values);
    
}

int create_files(int number_of_files, int number_of_values)
{
    srand(time(NULL));
    
    for(int i = 0; i < number_of_files; i++)
    {
        FILE * file;
        char file_name[30] = "./folder/";
        char file_number[20];
        sprintf(file_number, "%d", i);
        strcat(file_name, file_number);
        file = fopen(file_name, "w+");
        
        for(int j = 0; j < number_of_values; j++)
        {
            int random_value = rand();
            fprintf(file, "%d", random_value);
        }
        fclose(file);
    }
}

I have written a little program that overwrites memory. It creates useless files in a folder named "folder" (I am so creative). The purpose is to overwrite old data. It's not a very professional program because I am a beginner, but I think it should do for which it is destined: exhaust memory and thus maybe overwrite old data that was stored on it. If you have tips for me how to imrove this program or how to make it faster in it's execution I would be thankful!

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int create_files(int number_of_files, int number_of_values);

int main()
{
    int i;
    int number_of_files;
    int number_of_values;
    
    printf("before using this program create a folder named \"files\"\nin the same folder this program is located\n");
    printf("number of files: ");
    scanf("%d", &number_of_files);
    printf("number of values: ");
    scanf("%d", &number_of_values);
    
    create_files(number_of_files, number_of_values);
    
}

int create_files(int number_of_files, int number_of_values)
{
    srand(time(NULL));
    
    for(int i = 0; i < number_of_files; i++)
    {
        FILE * file;
        char file_name[30] = "./folder/";
        char file_number[20];
        sprintf(file_number, "%d", i);
        strcat(file_name, file_number);
        file = fopen(file_name, "w+");
        
        for(int j = 0; j < number_of_values; j++)
        {
            int random_value = rand();
            fprintf(file, "%d", random_value);
        }
        fclose(file);
    }
}

I have written a little program that overwrites memory. It creates useless files in a folder named "folder" (I am so creative). The purpose is to overwrite old data. It's not a very professional program because I am a beginner, but I think it should do for which it is destined: exhaust memory and thus maybe overwrite old data that was stored on it. If you have tips for me how to imrove this program or how to make it faster in it's execution I would be thankful!

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int create_files(int number_of_files, int number_of_values);

int main()
{
    int i;
    int number_of_files;
    int number_of_values;
    
    printf("before using this program create a folder with the name \"folder\"\nin the same folder this program is located\n");
    printf("number of files: ");
    scanf("%d", &number_of_files);
    printf("number of values: ");
    scanf("%d", &number_of_values);
    
    create_files(number_of_files, number_of_values);
    
}

int create_files(int number_of_files, int number_of_values)
{
    srand(time(NULL));
    
    for(int i = 0; i < number_of_files; i++)
    {
        FILE * file;
        char file_name[30] = "./folder/";
        char file_number[20];
        sprintf(file_number, "%d", i);
        strcat(file_name, file_number);
        file = fopen(file_name, "w+");
        
        for(int j = 0; j < number_of_values; j++)
        {
            int random_value = rand();
            fprintf(file, "%d", random_value);
        }
        fclose(file);
    }
}
further clarification of topic
Source Link
Dexter Thorn
  • 2.2k
  • 2
  • 22
  • 37
Loading
Source Link
Dexter Thorn
  • 2.2k
  • 2
  • 22
  • 37
Loading