#129387 - gmf - Tue May 22, 2007 8:47 am
I'm not a programmer by trade, but I've managed to skim through all topics and generally have found direct and sufficiently dumbed down terminology to address every difficulty I've had for the DS programming, except for this last one which has been gnawing me for a while. It's just a simple *.ini file write using libfat (the fread() works fine for the most part), but for some reason my output with fwrite() doesn't output more than four characters with each write. I'm using the latest devkitpro, libfat, and it says it's patching fine with the supercard lite DLDI (it's actually the only thing I have to test it on). The problem isn't logical, as I've just been looking at straight-up writes. Soooo... the following code (just testing stuff):
Yields the following output:
So it just outputs four characters from the beginning of each...Am I missing something terribly obvious here? I wouldn't expect it to be anything too complicated, as I'm very unacquainted with file outputs in c++ (i've just done in-lab quantitative analyses with regex in perl...seemingly much smoother, of course). So, apologies if this seems to be fundamentally a waste of anyone's time. I really did search the forums for a long time, and it seems that fwrite() in libfat hasn't had many complaints as of late.
And if this is just a random error, should I just tokenize everything into four character strings? (for some reason it doesn't like me doing that right now, but that has to be my own logic fault).
Code: |
FILE* init; char* line="AB\nCDE\nGHIJ"; char* line2="\nKLMNO\nPQRST"; init = fopen ("LC2.ini", "w"); fwrite(line , sizeof(line[0]) , sizeof(line) ,init); fwrite(line2 , sizeof(line2[0]) , sizeof(line2) ,init); fclose(init); |
Yields the following output:
Code: |
AB C KLM |
So it just outputs four characters from the beginning of each...Am I missing something terribly obvious here? I wouldn't expect it to be anything too complicated, as I'm very unacquainted with file outputs in c++ (i've just done in-lab quantitative analyses with regex in perl...seemingly much smoother, of course). So, apologies if this seems to be fundamentally a waste of anyone's time. I really did search the forums for a long time, and it seems that fwrite() in libfat hasn't had many complaints as of late.
And if this is just a random error, should I just tokenize everything into four character strings? (for some reason it doesn't like me doing that right now, but that has to be my own logic fault).