Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.

Releases: DevD4v3/P-Scanf

v2.0

12 Sep 21:42
429896f

Choose a tag to compare

New in v2.0 – Dynamic Strings 🎉

With P-Scanf, you can now declare a variable of type string without having to specify a fixed size.

Before (standard C)

#include <stdio.h>

int main(void) {
    char name[24];
    printf("Enter a string: ");
    fgets(name, 24, stdin);
    return 0;
}
  • You must predefine the buffer size (24 in this case).
  • Risk of buffer overflow if the input exceeds the allocated size.
  • Memory is always reserved, even if the input is small.

Now with P-Scanf

#include <stdio.h>
#include <pscanf.h>

int main(void) {
    string name = { NULL };
    strread(&name, "Enter a string: ");
    sfree();  // Free allocated memory
    pause();  // Wait for user input
    return 0;
}
  • No need to predefine size – memory is allocated dynamically.
  • Automatically handles string length tracking (name.length).
  • Memory is freed safely with sfree().

This makes input handling in C much safer and more convenient, especially when working with user-provided strings.

v1.0

29 Apr 22:26
1d2a513

Choose a tag to compare

Update README.md