Hey,
I have a data file that contains some annoying bytes. e.g. ^M instead of \n
I need to replace them, so I figured I'll go through the bytes one by one and replace them if necessary.
However my program doesn't want to do it. It goes to 100% CPU usage. Everything else goes rather smoothly.
This is in a program with coredata. The filename is stored and each time this record is fetched it just reads the data from file.
Any hints?
I have a data file that contains some annoying bytes. e.g. ^M instead of \n
I need to replace them, so I figured I'll go through the bytes one by one and replace them if necessary.
However my program doesn't want to do it. It goes to 100% CPU usage. Everything else goes rather smoothly.
This is in a program with coredata. The filename is stored and each time this record is fetched it just reads the data from file.
Code:
for (j=0; j< strlen(bytes); j++) {
switch ((int)bytes[j]) {
case 13:
//tab
//bytes[j] = 9;
//newline
//bytes[j] = 10;
//space
bytes[j] = 32;
break;
default:
break;
}
}
Any hints?