'lvalue required as unary ‘&’ operand' Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's my demo program's source code:

#include <stdio.h>
#include <stdlib.h>
#include <iconv.h>

int main()
{
  FILE *f1, *f2;
  char *a, *d;
  wchar_t *b;
  iconv_t c, n;
  b=(wchar_t *)malloc(100*4);/*Memory allocation for the wide character array*/
  a=(char *)malloc(100*(sizeof(char)));/*Memory allocation for the char array*/
  c=iconv_open("UCS-4", "UTF-8");/*As I am reading Bangla characters
encoded in UTF-8 as a binary, and want to convert it into UCS-4, the
encoding which is used in gcc internally, as far as I know.(I'm using
Ubuntu 10.04)*/
  f1=fopen("pop1", "rb");
  f2=fopen("pop2", "wb");
  d=(char *)b;//Casting the wchar pointer to char pointer for use in
iconv function
  fread(a, 1, 47, f1);//Reading
  n=iconv(c, &a, &sizeof(a), &d, &sizeof(b));/*The problem is here,
theoratically it should work, and I implemented it just as shown in
iconv manual of GNU*/
  fwrite(b, 4, 17, f2);
  iconv_close(c);
  fclose(f1);
  fclose(f2);
  return 0;
}

I have explained most of the things on comments. When I compile the
problem, it gives the following error:

test3.c:18: error: lvalue required as unary ‘&’ operand
test3.c:18: error: lvalue required as unary ‘&’ operand

I consulted many books and web resources before asking for help here,
but couldn't find any solution.

The problem is on iconv function. How can I get rid of this?

Thank you-
Rifat Mahmud



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux