int * splitString( char string[], int n )
{
int newArray[n];
return ( newArray );
}
Это очень плохо! Массив newArray
, локальный для функции, будет уничтожен при возврате функции. Вы будете упущены с обвисшим указателем, и его использование вызовет неопределенное поведение.
Вы не можете вернуть массив из функции. Лучшее, что вы можете сделать, это
int * splitString( char string[], int n )
{
int *newArray = malloc(n*sizeof(int)); // the array gets allocated on the heap rather than on the stack(1)
// Code
return ( newArray );
}
Не забудьте освободить выделенную память.
(1) Обратите внимание, что стандарт не использует / не определяет термин stack или куча как таковая.
Dim oldFileName = "C:\Test\16 Move File out of folder\GetICN.txt"
Dim newFileName = "C:\Test\16 Move File out of folder\GetICN2.txt"
Dim allText = System.IO.File.ReadAllText(oldFileName)
Dim matchs = System.Text.RegularExpressions.Regex.Matches(allText, "ICN-\w.*-\d+-\w+-\d+-\d\d")
Dim lines = matchs.Cast(Of System.Text.RegularExpressions.Match).Select(Function(m) m.Value)
System.IO.File.WriteAllLines(newFileName, lines)