Salve, ho un problema con questo programma che deve contare l'array e se di una certa lunghezza far reinserire con una parola più corta. Dunque a fine programma mi esce un errore "Stack around the variable 'file_lettura' was corrupted.".
codice:#include "stdafx.h" #include <iostream> #include <cstring> using namespace std; #define DIM 15 void controllo_lunghezza(char f[]) { int l = 0; while (1) { l = strlen(f); if (l >= DIM) { cout << "Nome file con al massimo 15 caratteri! Inserisci nuovamente: \n"; cin >> f; } else break; } } int main() { char file_lettura[DIM]; cout << "Inserisci il file di input(max 15 caratteri): "; cin >> file_lettura; controllo_lunghezza(file_lettura); return 0; }