on 08-27-2010 12:21 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.