🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages Started by Eriks Aleksans Wed, 18 Jul 2007 11:06
Need a help, fopen and unicode
#1577
Author: Eriks Aleksans
Date: Wed, 18 Jul 2007 11:06
38 lines
1732 bytes
Hi,

I need a help on this.
Here's a peace of code from BladeMP3EncDLL.c (from lame-3.97 project)


__declspec(dllexport) BE_ERR beWriteInfoTag( HBE_STREAM hbeStream,
											 LPCSTR lpszFileName )
{
	FILE* fpStream	= NULL;
	BE_ERR beResult	= BE_ERR_SUCCESSFUL;

	lame_global_flags*	gfp = (lame_global_flags*)hbeStream;
	
	
	if ( NULL == gfp )
	}
	if ( NULL != gfp )
	{
		// Do we have to write the VBR tag?
		if ( lame_get_bWriteVbrTag( gfp ) )
		{

			// Try to open the file
			fpStream=fopen( lpszFileName, "rb+" );

			.....


I'm calling this DLL from Delphi and it works just fine with non-unicode 
file names.

My question is how to change this C part so it will accept unicode 
filename and will open it as well. As I understand fopen does not work 
with unicode (or am I wrong?).

TIA
Eriks
Re: Need a help, fopen and unicode
#1578
Author: Ed Mulroy [TeamB]
Date: Wed, 18 Jul 2007 12:45
42 lines
2036 bytes
Just a guess but try using _wfopen instead and define UNICODE in the project 
options.

.  Ed

> Eriks Aleksans wrote in message
> news:469df4d2@newsgroups.borland.com...
> Hi,
>
> I need a help on this.
> Here's a peace of code from BladeMP3EncDLL.c (from lame-3.97 project)
>
>
> __declspec(dllexport) BE_ERR beWriteInfoTag( HBE_STREAM hbeStream,
> LPCSTR lpszFileName )
> {
> FILE* fpStream = NULL;
> BE_ERR beResult = BE_ERR_SUCCESSFUL;
>
> lame_global_flags* gfp = (lame_global_flags*)hbeStream;
>
>
> if ( NULL == gfp )
> }
> if ( NULL != gfp )
> {
> // Do we have to write the VBR tag?
> if ( lame_get_bWriteVbrTag( gfp ) )
> {
>
> // Try to open the file
> fpStream=fopen( lpszFileName, "rb+" );
>
> .....
>
>
> I'm calling this DLL from Delphi and it works just fine with non-unicode 
> file names.
>
> My question is how to change this C part so it will accept unicode 
> filename and will open it as well. As I understand fopen does not work 
> with unicode (or am I wrong?).
Re: Need a help, fopen and unicode
#1579
Author: Eriks Aleksans
Date: Wed, 18 Jul 2007 15:01
23 lines
1506 bytes
Hi,

Thanks for idea. I changed  LPCSTR  to wchar_t *  and
fopen( lpszFileName, "rb+" ) to _wfopen( lpszFileName, L"rb+" ) and now 
it works. Didn't even have to define UNICODE.

BR
Eriks



Ed Mulroy [TeamB] wrote:
> Just a guess but try using _wfopen instead and define UNICODE in the project 
> options.
> 
> .  Ed
> 
>> Eriks Aleksans wrote in message
>> news:469df4d2@newsgroups.borland.com...
>> Hi,
>>
>> I need a help on this.
>> Here's a peace of code from BladeMP3EncDLL.c (from lame-3.97 project)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads