cancel
Showing results for 
Search instead for 
Did you mean: 

NW RFC SDK: fopenU() not working

Former Member
0 Kudos

Hello everybody,

I'm having problems when writing files using the Unicode-enabled versions of the standard C functions that the NW RFC SDK provides (sapuc.h / libsapucum.dll).

I'm testing on Windows XP and Windows 2003.

Basically, after doing an fopenU(), I can only create 0-byte files.

Interestingly, fwrite() and fwriteU() both return the correct value for the number of bytes written, but the file remains at 0 bytes after being closed. So the data goes somewhere, but not into the file.

It's really simple, the most basic code exhibits the problem for me:

#define SAPonNT
#define SAPwithUNICODE
#include <stdio.h>
#include "sapnwrfc.h"
#include "sapuc.h"

void main(int argc, char** argv){
	int l = 0;
	FILE* outFile;
	outFile = fopenU(cU("message.xml"), cU("w"));
	l = fwriteU(cU("teststring"), 1, 10, outFile);
	printf("written: %d\n", l);
	fclose(outFile);
}

this produces the output:

written: 10

and a 0 byte file.

Also, the small demo program called companyClient.c that is included with the SDK has the same issue (it attempts to write a file at the end).

Am I doing something wrong? Any comments are appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member185954
Active Contributor
0 Kudos

Hello,

My C programming skills are pretty rusty now, however I would have thought the normal fopen() function supports other write parameters.

the write mode instead of "w", should be "w+" or "wb".

Please check the documentation on fwrite() funciton.

Regards,

Siddhesh

Former Member
0 Kudos

Thanks for the reply.

Unfortunately, w, w, wb and wb all produce the same result.