uz
Feedback

Firibgarlarga uchmang! Telemetrio bunday kanallarni topadi va belgilaydi 👉 Belgini ko‘rmoqchi bo‘lsangiz, obuna bo‘ling

Code With SaiPradeep

Code With SaiPradeep

Kanalga Telegram’da o‘tish

A space for curious minds to explore software engineering, computer science, programming and technology. Learn. Explore. Understand.

Ko'proq ko'rsatish

📈 Telegram kanali Code With SaiPradeep analitikasi

Code With SaiPradeep (@codewithsaipradeep) Ingliz til segmentidagi kanali faol ishtirokchi. Hozirda hamjamiyat 12 331 obunachidan iborat bo'lib, Texnologiyalar & Aralashmalar toifasida 10 226-o'rinni va Hindiston mintaqasida 31 277-o'rinni egallagan.

📊 Auditoriya ko‘rsatkichlari va dinamika

невідомо sanasidan buyon loyiha tez o‘sib, 12 331 obunachiga ega bo‘ldi.

11 Noyabr, 2026 dagi oxirgi ma’lumotlarga ko‘ra kanal barqaror faollikka ega. Oxirgi 30 kunda obunachilar soni -238 ga, so‘nggi 24 soatda esa -16 ga o‘zgardi va umumiy qamrov yuqori darajada qolmoqda.

  • Tasdiqlash holati: Tasdiqlanmagan
  • Jalb etish (ER): Auditoriya o‘rtacha 10.07% darajada jalb etiladi. Nashrdan keyingi dastlabki 24 soatda kontent odatda umumiy obunachilar sonining N/A% ini tashkil etuvchi reaksiyalarni to‘playdi.
  • Post qamrovi: Har bir post o‘rtacha 1 242 marta ko‘riladi; birinchi sutkada odatda 0 ta ko‘rish yig‘iladi.
  • Reaksiyalar va o‘zaro ta’sir: Auditoriya faol: har bir postga o‘rtacha 11 ta reaksiya keladi.
  • Tematik yo‘nalishlar: Kontent input, string, scanf("%d, array, element kabi asosiy mavzularga jamlangan.

📝 Tavsif va kontent siyosati

Muallif resursni shaxsiy fikrni ifoda etish maydoni sifatida ta’riflaydi:
“A space for curious minds to explore software engineering, computer science, programming and technology. Learn. Explore. Understand.”

Yuqori yangilanish chastotasi (oxirgi ma’lumot 12 Noyabr, 2026 da olingan) sababli kanal doimo dolzarb va katta qamrovli bo‘lib qoladi. Analitika auditoriya kontent bilan faol hamkorlik qilishini, uni Texnologiyalar & Aralashmalar toifasidagi muhim ta’sir nuqtasiga aylantirishini ko‘rsatadi.

12 331
Obunachilar
-1624 soatlar
-807 kun
-23830 kun
Postlar arxiv
🔧 Recursion

💻 Split Large File into Smaller Files
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
    char inputFile[100];
    char outputFilePrefix[100];
    long long chunkSize;

    printf("Enter the input file name: ");
    scanf("%s", inputFile);

    printf("Enter the output file prefix: ");
    scanf("%s", outputFilePrefix);

    printf("Enter the chunk size in bytes: ");
    scanf("%lld", &chunkSize);

    FILE *fp = fopen(inputFile, "rb");
    if (fp == NULL) {
        printf("Error opening input file.n");
        return 1;
    }

    int fileCount = 1;
    long long bytesRead = 0;
    unsigned char *buffer = (unsigned char *)malloc(chunkSize);

    if (buffer == NULL) {
        printf("Memory allocation error.n");
        fclose(fp);
        return 1;
    }

    while (1) {
        size_t bytes = fread(buffer, 1, chunkSize, fp);

        if (bytes == 0) {
            break; // End of file
        }

        char outputFileName[200];
        sprintf(outputFileName, "%s_%03d.part", outputFilePrefix, fileCount);

        FILE *outFile = fopen(outputFileName, "wb");
        if (outFile == NULL) {
            printf("Error creating output file.n");
            fclose(fp);
            free(buffer);
            return 1;
        }

        fwrite(buffer, 1, bytes, outFile);
        fclose(outFile);

        bytesRead += bytes;
        fileCount++;
    }

    fclose(fp);
    free(buffer);

    printf("File split successfully.n");

    return 0;
}
📤 Output:
Input: input.txt
Input: output
Input: 1000
Output: Enter the input file name: Enter the output file prefix: Enter the chunk size in bytes: Error opening input file.

💻 Read File in Reverse Order
#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *file;
    char filename[100];
    long file_size;

    printf("Enter the filename: ");
    scanf("%s", filename);

    file = fopen(filename, "r");
    if (file == NULL) {
        perror("Error opening file");
        return 1;
    }

    fseek(file, 0, SEEK_END);
    file_size = ftell(file);

    if (file_size == -1L) {
        perror("Error getting file size");
        fclose(file);
        return 1;
    }

    char *buffer = (char *)malloc(file_size + 1);
    if (buffer == NULL) {
        perror("Memory allocation failed");
        fclose(file);
        return 1;
    }

    fseek(file, 0, SEEK_SET);
    if (fread(buffer, 1, file_size, file) != file_size) {
        perror("Error reading file");
        fclose(file);
        free(buffer);
        return 1;
    }
    buffer[file_size] = '0';

    printf("File content in reverse order:n");
    for (long i = file_size - 1; i >= 0; i--) {
        printf("%c", buffer[i]);
    }
    printf("n");

    fclose(file);
    free(buffer);

    return 0;
}
📤 Output:
Input: test.txt
Output: Enter the filename: File content in reverse order:
dlrow olleH

💻 Append Data to Existing File
#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *fptr;
    char data[100];

    printf("Enter data to append: ");
    scanf(" %[^n]", data);

    fptr = fopen("example.txt", "a"); // Open file in append mode

    if (fptr == NULL) {
        printf("Error opening file!n");
        return 1;
    }

    fprintf(fptr, "%sn", data);

    printf("Data appended successfully!n");

    fclose(fptr);

    return 0;
}
📤 Output:
Input: This is some new data.
Output: Enter data to append: Data appended successfully!

💻 Write Data to CSV File
#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *fp;
    char filename[50];
    char name[50];
    int age;
    float salary;

    printf("Enter the filename to write to (e.g., data.csv): ");
    scanf("%s", filename);

    fp = fopen(filename, "w");

    if (fp == NULL) {
        printf("Error opening file!n");
        return 1;
    }

    printf("Enter name: ");
    scanf("%s", name);
    printf("Enter age: ");
    scanf("%d", &age);
    printf("Enter salary: ");
    scanf("%f", &salary);

    fprintf(fp, "%s,%d,%.2fn", name, age, salary);

    fclose(fp);

    printf("Data written to %s successfully!n", filename);

    return 0;
}
📤 Output:
Input: data.csv
Output: Enter the filename to write to (e.g., data.csv): Enter name: John
Input: John
Output: Enter age:
Input: 30
Output: Enter salary:
Input: 50000.50
Output: Data written to data.csv successfully!

💻 Read CSV File and Process Data
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
    FILE *fp;
    char filename[100];
    char line[200];
    char *token;
    int data1, data2;

    printf("Enter the CSV filename: ");
    scanf("%s", filename);

    fp = fopen(filename, "r");

    if (fp == NULL) {
        printf("Error opening file!n");
        return 1;
    }

    // Read header line (optional)
    fgets(line, sizeof(line), fp);

    while (fgets(line, sizeof(line), fp) != NULL) {
        token = strtok(line, ",");
        if (token != NULL) {
            data1 = atoi(token); // Convert string to integer
        }

        token = strtok(NULL, ",");
        if (token != NULL) {
            data2 = atoi(token); // Convert string to integer
        }

        printf("Data 1: %d, Data 2: %dn", data1, data2);
    }

    fclose(fp);
    return 0;
}
📤 Output:
Input: data.csv
Output: Enter the CSV filename: Data 1: 10, Data 2: 20
Data 1: 30, Data 2: 40
Data 1: 50, Data 2: 60

(Assuming data.csv contains the following:)
Header1,Header2
10,20
30,40
50,60
Input: non_existent_file.csv
Output: Enter the CSV filename: Error opening file!

💻 Count Occurrences of Specific Word in File
// Code not available
📤 Output:
Since the C code is not provided, I can only provide hypothetical examples based on the problem description "Count Occurrences of Specific Word in File".

Example 1:

Input: file.txt
Input: the
Output: The word 'the' appears 5 times in the file.

Example 2:

Input: data.txt
Input: apple
Output: The word 'apple' appears 2 times in the file.

Example 3 (File Not Found):

Input: non_existent_file.txt
Input: anyword
Output: Error opening file.

Example 4 (Word Not Found):

Input: file.txt
Input: banana
Output: The word 'banana' appears 0 times in the file.

Example 5 (Empty File):

Input: empty.txt
Input: anyword
Output: The word 'anyword' appears 0 times in the file.

💻 Reverse Contents of File
#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *file, *tempFile;
    char filename[100];
    char ch;
    long fileLen;

    printf("Enter the filename: ");
    scanf("%s", filename);

    file = fopen(filename, "r");
    if (file == NULL) {
        printf("Error opening the file.n");
        return 1;
    }

    fseek(file, 0, SEEK_END);
    fileLen = ftell(file);
    fseek(file, 0, SEEK_SET);

    char *buffer = (char *)malloc(fileLen * sizeof(char));
    if (buffer == NULL) {
        printf("Memory allocation failed.n");
        fclose(file);
        return 1;
    }

    fread(buffer, 1, fileLen, file);
    fclose(file);

    tempFile = fopen("temp.txt", "w");
    if (tempFile == NULL) {
        printf("Error creating temporary file.n");
        free(buffer);
        return 1;
    }

    for (long i = fileLen - 1; i >= 0; i--) {
        fputc(buffer[i], tempFile);
    }
    fclose(tempFile);
    free(buffer);

    file = fopen(filename, "w");
    if (file == NULL) {
        printf("Error opening the file for writing.n");
        return 1;
    }

    tempFile = fopen("temp.txt", "r");
    if (tempFile == NULL) {
        printf("Error opening temporary file for reading.n");
        fclose(file);
        return 1;
    }

    while ((ch = fgetc(tempFile)) != EOF) {
        fputc(ch, file);
    }

    printf("File reversed successfully.n");

    fclose(file);
    fclose(tempFile);
    remove("temp.txt");

    return 0;
}
📤 Output:
Input: input.txt
Output: Enter the filename: File reversed successfully.

💻 Remove Blank Lines from File
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
    char filename[100];
    FILE *inputFile, *tempFile;
    char line[200];

    printf("Enter the filename: ");
    scanf("%s", filename);

    inputFile = fopen(filename, "r");
    if (inputFile == NULL) {
        perror("Error opening input file");
        return 1;
    }

    tempFile = fopen("temp.txt", "w");
    if (tempFile == NULL) {
        perror("Error opening temporary file");
        fclose(inputFile);
        return 1;
    }

    while (fgets(line, sizeof(line), inputFile) != NULL) {

        int isBlank = 1;
        for (int i = 0; line[i] != '0'; i++) {
            if (line[i] != ' ' && line[i] != 'n' && line[i] != 'r') {
                isBlank = 0;
                break;
            }
        }

        if (!isBlank) {
            fputs(line, tempFile);
        }
    }

    fclose(inputFile);
    fclose(tempFile);

    remove(filename);
    rename("temp.txt", filename);

    printf("Blank lines removed successfully.n");

    return 0;
}
📤 Output:
Input: input.txt
Output: Enter the filename: Blank lines removed successfully.

💻 Find Most Frequent Word in File
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main() {
    FILE *fp;
    char word[50];
    char frequent_word[50] = "";
    int count = 1, max_count = 0;
    char words[100][50];
    int freq[100] = {0};
    int num_words = 0;
    int i, j;

    fp = fopen("input.txt", "r");

    if (fp == NULL) {
        printf("Error opening file.n");
        return 1;
    }

    while (fscanf(fp, "%s", word) != EOF) {
        int found = 0;
        for (i = 0; i < num_words; i++) {
            if (strcmp(words[i], word) == 0) {
                freq[i]++;
                found = 1;
                break;
            }
        }
        if (!found) {
            strcpy(words[num_words], word);
            freq[num_words]++;
            num_words++;
        }
    }

    fclose(fp);

    for (i = 0; i < num_words; i++) {
        if (freq[i] > max_count) {
            max_count = freq[i];
            strcpy(frequent_word, words[i]);
        }
    }

    printf("Most frequent word: %sn", frequent_word);
    printf("Frequency: %dn", max_count);

    return 0;
}
📤 Output:
// Code not available

💻 Find Longest Word in File
#include <stdio.h>
#include <string.h>

int main() {
    FILE *fp;
    char filename[100];
    char word[100];
    char longestWord[100] = "";
    int longestLength = 0;

    printf("Enter the filename: ");
    scanf("%s", filename);

    fp = fopen(filename, "r");

    if (fp == NULL) {
        printf("Error opening file.n");
        return 1;
    }

    while (fscanf(fp, "%s", word) == 1) {
        int len = strlen(word);
        if (len > longestLength) {
            longestLength = len;
            strcpy(longestWord, word);
        }
    }

    fclose(fp);

    if (longestLength > 0) {
        printf("Longest word: %sn", longestWord);
    } else {
        printf("No words found in the file.n");
    }

    return 0;
}
📤 Output:
Input: test.txt
Output: Error opening file.

Input: my_file.txt
Output: Enter the filename: my_file.txt
Longest word: programming

Input: data.txt
Output: Enter the filename: data.txt
No words found in the file.

💻 Merge Two Files into a Third File
#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *file1, *file2, *mergedFile;
    char filename1[100], filename2[100], mergedFilename[100];
    char ch;

    printf("Enter the name of the first file: ");
    scanf("%s", filename1);

    printf("Enter the name of the second file: ");
    scanf("%s", filename2);

    printf("Enter the name of the merged file: ");
    scanf("%s", mergedFilename);

    file1 = fopen(filename1, "r");
    if (file1 == NULL) {
        printf("Error opening file %sn", filename1);
        return 1;
    }

    file2 = fopen(filename2, "r");
    if (file2 == NULL) {
        printf("Error opening file %sn", filename2);
        fclose(file1);
        return 1;
    }

    mergedFile = fopen(mergedFilename, "w");
    if (mergedFile == NULL) {
        printf("Error opening file %s for writingn", mergedFilename);
        fclose(file1);
        fclose(file2);
        return 1;
    }

    while ((ch = fgetc(file1)) != EOF) {
        fputc(ch, mergedFile);
    }

    fclose(file1);

    while ((ch = fgetc(file2)) != EOF) {
        fputc(ch, mergedFile);
    }

    fclose(file2);
    fclose(mergedFile);

    printf("Files merged successfully into %sn", mergedFilename);

    return 0;
}
📤 Output:
Input: file1.txt
Input: file2.txt
Input: merged.txt
Output: Enter the name of the first file: Enter the name of the second file: Enter the name of the merged file: Files merged successfully into merged.txt

💻 Count Frequency of Words in a File
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#define MAX_WORD_LENGTH 100
#define MAX_WORDS 1000

int main() {
    FILE *fp;
    char filename[100];
    char word[MAX_WORD_LENGTH];
    char words[MAX_WORDS][MAX_WORD_LENGTH];
    int counts[MAX_WORDS];
    int num_words = 0;
    int i, j;

    printf("Enter the filename: ");
    scanf("%s", filename);

    fp = fopen(filename, "r");
    if (fp == NULL) {
        printf("Error opening file.n");
        return 1;
    }

    while (fscanf(fp, "%s", word) == 1) {
        for (i = 0; word[i]; i++) {
            word[i] = tolower(word[i]);
            if (!isalnum(word[i])) {
                word[i] = '0';
                break;
            }
        }
        if(word[0] == '0') continue;

        int found = 0;
        for (i = 0; i < num_words; i++) {
            if (strcmp(words[i], word) == 0) {
                counts[i]++;
                found = 1;
                break;
            }
        }

        if (!found) {
            strcpy(words[num_words], word);
            counts[num_words] = 1;
            num_words++;
        }
    }

    fclose(fp);

    printf("Word Frequencies:n");
    for (i = 0; i < num_words; i++) {
        printf("%s: %dn", words[i], counts[i]);
    }

    return 0;
}
📤 Output:
Input: test.txt
Output: Error opening file.

Input: my_file.txt
Output: Enter the filename: my_file.txt
Word Frequencies:

Input: data.txt
Output: Enter the filename: data.txt
Word Frequencies:
this: 1
is: 1
a: 1
test: 1
file: 1

Input: input.txt
Output: Enter the filename: input.txt
Word Frequencies:
hello: 2
world: 1
this: 1
is: 1
a: 1
test: 1

Input: words.txt
Output: Enter the filename: words.txt
Word Frequencies:
the: 2
quick: 1
brown: 1
fox: 1
jumps: 1
over: 1
lazy: 1
dog: 1
a: 1

💻 Find and Replace a Word in a File
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
    char filename[100], wordToReplace[100], replacementWord[100];
    char buffer[1000];
    FILE *file, *tempFile;

    printf("Enter filename: ");
    scanf("%s", filename);

    printf("Enter word to replace: ");
    scanf("%s", wordToReplace);

    printf("Enter replacement word: ");
    scanf("%s", replacementWord);

    file = fopen(filename, "r");
    if (file == NULL) {
        printf("Unable to open file.n");
        return 1;
    }

    tempFile = fopen("temp.txt", "w");
    if (tempFile == NULL) {
        printf("Unable to create temporary file.n");
        fclose(file);
        return 1;
    }

    while (fgets(buffer, sizeof(buffer), file) != NULL) {
        char *position = strstr(buffer, wordToReplace);
        if (position != NULL) {

            char temp[1000];
            strncpy(temp, buffer, position - buffer);
            temp[position - buffer] = '0';
            strcat(temp, replacementWord);
            strcat(temp, position + strlen(wordToReplace));
            fprintf(tempFile, "%s", temp);
        } else {
            fprintf(tempFile, "%s", buffer);
        }
    }

    fclose(file);
    fclose(tempFile);

    remove(filename);
    rename("temp.txt", filename);

    printf("Word replaced successfully.n");

    return 0;
}
📤 Output:
Input: input.txt
Input: oldword
Input: newword
Output: Unable to open file.

💻 Copy Contents of One File to Another
#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *sourceFile, *destFile;
    char ch;
    char sourceFileName[100], destFileName[100];

    printf("Enter the name of the source file: ");
    scanf("%s", sourceFileName);

    printf("Enter the name of the destination file: ");
    scanf("%s", destFileName);

    sourceFile = fopen(sourceFileName, "r");
    if (sourceFile == NULL) {
        printf("Unable to open source file.n");
        return 1;
    }

    destFile = fopen(destFileName, "w");
    if (destFile == NULL) {
        printf("Unable to open destination file.n");
        fclose(sourceFile);
        return 1;
    }

    while ((ch = fgetc(sourceFile)) != EOF) {
        fputc(ch, destFile);
    }

    printf("File copied successfully.n");

    fclose(sourceFile);
    fclose(destFile);

    return 0;
}
📤 Output:
Input: source.txt
Input: destination.txt
Output: Enter the name of the source file: Enter the name of the destination file: File copied successfully.

💻 Count Number of Characters in a File
#include <stdio.h>

int main() {
  FILE *file;
  char filename[100];
  char ch;
  int char_count = 0;

  printf("Enter the filename: ");
  scanf("%s", filename);

  file = fopen(filename, "r");

  if (file == NULL) {
    printf("Error opening file.n");
    return 1;
  }

  while ((ch = fgetc(file)) != EOF) {
    char_count++;
  }

  fclose(file);

  printf("Number of characters in the file: %dn", char_count);

  return 0;
}
📤 Output:
Input: test.txt
Output: Enter the filename: Number of characters in the file: 26

💻 Count Number of Words in a File
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main() {
    FILE *file;
    char filename[100];
    char ch;
    int wordCount = 0;
    int inWord = 0;

    printf("Enter the filename: ");
    scanf("%s", filename);

    file = fopen(filename, "r");

    if (file == NULL) {
        printf("Error opening file.n");
        return 1;
    }

    while ((ch = fgetc(file)) != EOF) {
        if (isalnum(ch)) {
            if (!inWord) {
                inWord = 1;
                wordCount++;
            }
        } else {
            inWord = 0;
        }
    }

    fclose(file);

    printf("Number of words: %dn", wordCount);

    return 0;
}
📤 Output:
Input: my_file.txt
Output: Error opening file.

Input: test.txt
Output: Enter the filename: Number of words: 5

💻 Count Number of Lines in a File
#include <stdio.h>

int main() {
    FILE *file;
    char ch;
    int line_count = 0;
    char filename[100];

    printf("Enter the filename: ");
    scanf("%s", filename);

    file = fopen(filename, "r");

    if (file == NULL) {
        printf("Error opening file!n");
        return 1;
    }

    while ((ch = fgetc(file)) != EOF) {
        if (ch == 'n') {
            line_count++;
        }
    }

    fclose(file);

    printf("Number of lines in the file: %dn", line_count);

    return 0;
}
📤 Output:
Input: test.txt
Output: Enter the filename: Number of lines in the file: 0

Input: input.txt
Output: Enter the filename: Number of lines in the file: 0

Input: myfile.txt
Output: Enter the filename: Error opening file!

Input: data.txt
Output: Enter the filename: Number of lines in the file: 0

💻 Read a Text File and Print Contents
#include <stdio.h>
#include <stdlib.h>

int main() {
    FILE *file;
    char ch;
    char filename[100];

    printf("Enter the filename to read: ");
    scanf("%s", filename);

    file = fopen(filename, "r");

    if (file == NULL) {
        printf("Error opening file!n");
        return 1;
    }

    while ((ch = fgetc(file)) != EOF) {
        printf("%c", ch);
    }

    fclose(file);

    return 0;
}
📤 Output:
Input: test.txt
Output: Enter the filename to read: This is a test file.
It has multiple lines.
With some sample text.

🔧 File Handling