Problem with ANSI is that the extended set isn't standard. It may look like russian on your computer, but it's not going to do so on everybody else's computer.
Which is, at least partially, why unicode exists today.
Printable View
Problem with ANSI is that the extended set isn't standard. It may look like russian on your computer, but it's not going to do so on everybody else's computer.
Which is, at least partially, why unicode exists today.
I need to set char set Latin 4, it's also called ISO-8859-4, but i still can't find anything, explaning how to deal with that. :rolleyes:
First maybe try this http://www.russianlocalization.com/Texts/Encoding.htm
To see if you can see text displayed in the specified encoding?
PS. Also note they are metntioning ISO 8859-5 not 4
Also I wanted to ask how to print these strings, because every try computer writes me 'runtime error'
Code:#include <stdio.h>
int main () {
char string[100][3];
int i, j;
j=0;
while (j<4)
{fgets(string[j], sizeof string[j], stdin);
for(i=0;i<3;i++)
{if(string[j][i]=='\n')
{string[j][i]='\0';
j+=1; break;}}
}
return(0);
Code:#include <stdio.h>
#include <string.h>
int main ()
{
char string[3][100];
int j;
for(j=0;j<3;j++)
{
char* p;
fgets(string[j], sizeof string[j], stdin);
p = strchr(string[j],'\n');
if(p) *p = '\0';
}
for(j=0;j<3;j++)
{
printf("String number %d: \"%s\"\n", j, string[j]);
}
return 0;
}
Thanks a lot :cool: The problem was that I haven't included string.h Thank's very much :)
Hello again. Could anyone help me to find mistakes why this programs prints out only the lats string.
Code:
#include <stdio.h>
#include <string.h>
#define SIZE 124
int main ()
{
char *string[3];
char buf[SIZE], input[SIZE];
int j, num;
for(j=0;j<3;j++)
{
printf("\nPlease input string number %d: ",j+1);
fgets(input, SIZE, stdin);
num = sscanf(input, "%s", &buf);
if (num==1)
string[j] = buf;
else printf("error");
}
for(j=0;j<3;j++)
printf("%s\n",string[j]);
return 0;
}
Erm, maybe your problem is here.Code:for(j=0;j<3;j++)
printf("%s\n",string[0]);
Could anyone explain me why this program prints out
"Enter string 0"
"Enter string 1"
at one time and doesn't read the string[0][100] ?
Code:#include <stdio.h>
#include <string.h>
int main ()
{
char string[3][100];
int j;
for(j=0;j<3;j++)
{
char* p;
printf("Enter string %d",j);
fgets(string[j], sizeof string[j], stdin);
p = strchr(string[j],'\n');
if(p) *p = '\0';
}
for(j=0;j<3;j++)
{
printf("String number %d: \"%s\"\n", j, string[j]);
}
return 0;
}
I have no explanation to that - is that the entire program, or is that "reduced", and if it is reduced, does it actually show the problem in reduced form. My instinct tells me that you have a scanf() before the fgets() that leaves a newline in the input buffer.
--
Mats
you also need to add fflush(stdout) between
printf and fgets
Thanks :cool: