mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
cfg read error fixed. "First section must be [net] or [network]"
Many users have problems while parsing cfg file when it is copied from other systems due to newline character.
This commit is contained in:
parent
80d9bec20f
commit
a70f897277
@ -778,6 +778,7 @@ list *read_cfg(char *filename)
|
|||||||
while((line=fgetl(file)) != 0){
|
while((line=fgetl(file)) != 0){
|
||||||
++ nu;
|
++ nu;
|
||||||
strip(line);
|
strip(line);
|
||||||
|
line[ strcspn(line, "\r\n") ] = '\0';
|
||||||
switch(line[0]){
|
switch(line[0]){
|
||||||
case '[':
|
case '[':
|
||||||
current = malloc(sizeof(section));
|
current = malloc(sizeof(section));
|
||||||
|
Loading…
Reference in New Issue
Block a user