stdio.h is completely irrelevant.
Ah sorry, I was under the impression for some reason that you could use some of the stdio functions to be able to scan the bit stream as one big chunk of data, but I see now as "ejeffrey" pointed out that stdio is more for handling file bit streams not just any serial data.
A "buffer" and an "array" are exactly the same thing, and the correct and only way to do it.
The reason I brought up an array earlier is that the way I have things written is with a transfer() function which transfers how ever many bytes of data and individually stores them into an array. The problems arose when I tried working with the array outside of the function. You can't return the array so I was curious if there was another sort of "buffer object" that would allow me to deal with this stuff easier.
What kind of SPI hardware does your chip have and how are you using it?
Are you manipulating the clock and MOSI and SS and reading MISO by using digital IO pins yourself? Or do you have SPI hardware that does that automatically and puts the result in a buffer? How big? One byte? More? If there is a hardware buffer, how are you deciding when there is data in it?
I'm currently using an ATTiny84A chip. It uses AVR's Universal Serial Interface (USI) for serial communication. It's SPI (Two/Three wire interface is what they call it, I suppose to avoid legal trouble?) hardware isn't anything to write home about; It's not much better than just bit banging the data, but it gives you an 8 bit shift buffer and dedicated DO/MOSI, DI/MISO, and clock lines. The clock line is a little tedious, you can either control it with a timer, externally, or through software by toggling a specific clock bit, which is what I am doing (one could also just literally toggle it through software and it'd make little to no difference.). The chip doesn't offer a dedicated SS line but it doesn't matter, the GPIO works fine for me. I'm more or less just quickly throwing stuff together for testing purposes, so nothing is fleshed out or proper but at the moment I am just counting how many clock cycles I'm sending and using that to tell when the cycle is finished. For that purpose there is also an internal 4 bit counter inside of the chip that will flag you when the transfer is complete which ill end up using eventually but i didn't bother at the moment.
Your question is far too vague, but in general the short answer is that an array in C is the only way to do thing. You can choose how you allocate that array (global variable, local variable, alloca, malloc) but you need it.
I do apologize for the vagueness, I completely agree that I should have been a bit more thorough/in depth with my question. I suppose the allocation is what I have been having trouble with. It would eat up a decent amount of space if I allocate it globally, and I've always read that it's very bad practice unless absolutely necessary to declare a global variable. Now that you mention malloc() however, that could possibly work pretty well, then I could use free() to deallocate it after I use it. Like a global variable with benefits!
A char array is the normal way to handle byte sequences in C. Can you be more explicit about what you are doing and what you don't like about it?
Alright, noted! What I was having problems with was dealing with the array and functions. Functions don't seem to play overly well with arrays in C. It was starting to become tedious for me, so I figured that there had to be a way to do things far simpler than the way that I was handling them.
stdio provides stream wrappers around file like objects. In some cases you might want to wrap a SPI peripheral in a stdio stream but it is not particularly common. Normally SPI is transaction oriented (delimited by nCS) so a stream wrapper doesn't make a lot of sense.
Ah interesting, I was not aware of that. I was under the impression that the functions in stdio were more versatile; I thought that they could be used for any bit stream. My mistake.
What do you mean by "delimited by nCS"?