Hi!
I just want to ask you guys if there is a possibility to write 2^16 (65536) different characters into a file?
Thank you in advance for your answers,
Gašper.
Hi!
I just want to ask you guys if there is a possibility to write 2^16 (65536) different characters into a file?
Thank you in advance for your answers,
Gašper.
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
why wouldn't it be?
If it is possible than tell me how ?
I would really love to see an example (c program).
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
char buff[65536];
fwrite ( buff, sizeof(buff), 1, fp );
Of course, if you're using crummy 16 bit DOS, then you can't do this....
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
...and don't forget to use fopen and fclose...
Salem:
I'm using 16 Bit DOS compiler (TURBO C++ 3.0). Where could I find the newest compiler that will support 65536 different characters?
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
http://www.compilers.net/ has a selection
DJGPP is perhaps the most DOS-like - though it is a 32 bit compiler.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I've just downloaded from here:
http://www.cprogramming.com/borland.html
it looks like you are trying to write binary, if so here is a sample from a project that i've just completed. select code copy paste and try it. this is in DEV-C++
int main()
{
short Decimal, Octal, Hexadecimal;
int Stop = 0, temp, Binary;
char Continue[16];
Decimal = 0;
do
{
Stop = Decimal + 16; // stops after a display of 0-15 prompt to continue
printf("Decimal\t\tBinary\t\t\t0ctal\t\tHexadecima l\t\n");
printf("\n");
do
{
printf("%d\t\t", Decimal);
temp = Decimal;
for (Binary = 128; Binary > 0; Binary /= 2)
{
if (temp >= Binary)
{
printf("1");
temp -= Binary;
}
else
printf("0");
if (Binary == 16)
printf(" ");
}
temp = Octal;
printf("\t\t%o\t\t%hx\n", Decimal, Decimal);
Decimal++;
}
while (Decimal < Stop );
printf("\nTo Continue press enter, (N) to end : ");
fgets(Continue,16,stdin);
}
while (!strstr(Continue,"n")&& !strstr(Continue,"N"));
return 0;
}
folks!
Example of my program:
for (i=0; i<=65535; i++)
{
fprintf(fout, "%c", i);
}
Now, my compiler writes only 256 different characters (ASCII Table), but I want that it will write into file 2^16 different characters.
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
You are confused.
A 'char' is only 8 bits, thus, you have a maximum of 256 values.
A 'short int' is 16 bits.
Thus, if you read a single byte, you will only ever get one of 256 different values. If you want more, read or write more than a byte at a time.
Quzah.
Hope is the first step on the road to disappointment.
phew... i thought salem's wisdom had an end for a second there... especially over something that's a fundamental truth... yes it's a matter of reading/writing... hmmm... i have heard of unicode 16 bit characters... but don't know the specifics of it...
oh wait, he means since you can't get the whole segment... ::is enlightened to truth::...
my oh my...
hasafraggin shizigishin oppashigger...
Turn the computer off. Take it back to the store. You are more suited towards other interests and lines of work.
Sorry, but not everybody can, or even should, be near a computer.
who was that directed at? if that was directed at me... you do remember me from the old board right sayeh? if there is a problem, confront...
hasafraggin shizigishin oppashigger...
> phew... i thought salem's wisdom had an end for a second there
Must be time for some deliberate mistakes then, to see who's awake
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.