x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Why vfprintf is different in unreal engine ?

I use a c++ plugin to write some text to a file and I use the vfprintf function. In a visual studio application the output would be :a|b|c but UnrealEngine writes to file a(!!T#b(!!T#c. Any idea how to solve this ? Thankyou

Product Version: UE 4.18
Tags:
more ▼

asked Aug 30 '18 at 11:36 AM in C++ Programming

avatar image

BestWarrior
34 3 3 8

avatar image dZh0 Aug 30 '18 at 03:22 PM

It depends on how you generate the text and it's type but you have provided no code.

I can tell you from now that UE4 has a specific rules for handling strings and files (see FFileHelper). Some of the C++ library functions are not supported along with some data types in order to be cross-platform. (I assume)

Check the documentation if you haven't.

avatar image BestWarrior Aug 30 '18 at 08:53 PM

Hi, thankyou for answering. I used FString Fs = FString(ANSI_TO_TCHAR(arr)); FString Fs = FString(UTF8_TO_TCHAR(arr)); but its the same output so I think there is a problem when it compiles the c code. I think its missing the _MBCS setting which is in the default visual studio project

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

I solved this, the encoding was not the problem. I was writing a char instead of a char * to the file.

more ▼

answered Sep 04 '18 at 03:51 PM

avatar image

BestWarrior
34 3 3 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

To directly answer the question: There is a discrepancy between the encoding of your input and your output. A string is useless without it's encoding information. See: Character Encoding.

As I implied in the comment, you should not use special characters in your text files. Always save strings in the provided types by the engine.

This is already asked in a sort but for Asian characters: https://answers.unrealengine.com/questions/802364/view.html

The answer there is very exhaustive.

more ▼

answered Aug 30 '18 at 09:23 PM

avatar image

dZh0
1.3k 6 5 9

avatar image BestWarrior Aug 31 '18 at 01:23 PM

I wrote the text like this

int cst_sprintf(char *s, const char *fmt, ...) { va_list args; int rv; va_start(args, fmt); rv = vsprintf(s, fmt, args); va_end(args); return rv; } I even tried to send the text through a char array and the output is the same.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question