Segfault i think?

I have some simple code that should in theory work, but for some reason it fails? Any ideas?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
void sleepLineGen(float sleeps, char buffer[255])
{
    strcpy(buffer,"sleep :");
    char bufferNum[255];
    ftoa(sleeps,bufferNum);
    if(bufferNum[0]=='.') popBeg(bufferNum,'0');
    strcat(buffer,bufferNum);
}

//code that fails
            char sleepLine[255];
            sleepLine[0]=0;
            sleepLineGen(sleepCont,sleepLine);
            appTF(out,sleepLine);

This code is ran multiple times, and appTF and sleepLineGen work as intented. This however crashes at sleepLineGen; Be aware that popBeg works, and ftoa does too.
Last edited on
Post a testcase that does reproduce your issue.
we need to be able to compile and run your program.

¿what does popBeg() do? I'm guessing that you miss the null terminator.
Topic archived. No new replies allowed.