COKEDUDE 27 Junior Poster in Training

I need to read a file that is completely random and do something based on whatever character I get. I can get any of these character types "/", "*", a string, or numbers. I need to do something different with each case. I think the best way would be to start with fgets and read line by line. After that I would usually use sscanf, but since the files I will be reading are completely random I'm not sure how to do this. This is what I have started with. Any ideas would be greatly appreciated :).

while(fgets(buffer, 80, fp) != NULL)
{
    /*if(/)
    {
        //do something for "/" character
    }
    if(*)
    {
        //do something for "*" character
    }
    if(string)
    {
        //do something for string
    }
    if(numbers)
    {
        //do something for numbers
    }*/
    memset(buffer, 0, 80);
}

Why is my text getting italisized?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.