Re: unicode string

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Ilya Manin (IlyaM_at_softspb.com)
Date: 08/23/04


Date: Mon, 23 Aug 2004 13:26:13 +0400

You must to use "%s" flag (small 's') -
     wsprintf(szFilename, _T("\\temp\\zenit-%s.asc"), knoopnummer);
Big 'S' get non unicode string (char*)

"Nr 7" <nrzeven@hotmail.com> wrote in message
news:df1b6527.0408230027.6d11df9f@posting.google.com...
> My program reads a file (containing one string). This string
> represents a filename.
>
> I want to create another file with this name.
>
> the code is :
>
> void SaveImage ()
> {
> TCHAR szFilename[255];
> wchar_t knoopnummer[255];
>
> GetKnoopnummerValue (knoopnummer); //reads the filename
> wsprintf(szFilename, _T("\\temp\\zenit-%S.asc"), knoopnummer);
> MessageBox(NULL,szFilename,TEXT("MESSAGE"),MB_OK);
>
> CreateFile(szFilename);
> }
>
> The strange thing is, that the message in the Messagebox is correct,
> but the filename is not correct when the new file is created. Only the
> first character is written.
>
> e.g. When the file contains 1234, the new file looks like 1.asc
> instead of 1234.asc.
>
> Any idea what is wrong?



Relevant Pages

  • file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: unbuffered file IO?
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)