Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6645139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:14:58+00:00 2026-05-26T00:14:58+00:00

I am compiling a code segment using something like this: char* filename = (char*)

  • 0

I am compiling a code segment using something like this:

char* filename = (char*) malloc( fileInfo.size_filename +1 );
unzGetCurrentFileInfo(_unzFile, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0);
filename[fileInfo.size_filename] = '\0';

NSString * strPath = [NSString  stringWithCString:filename];

but stringWithCString is deprecated. I am supposed to change that to

NSString * strPath = [NSString  stringWithCString:filename encoding:????];

this filename as the name says represents entries on the file system, files and directories. How do I know the encoding filename is using? I mean, I can put UTF-8, but who knows which encoding users around the world will be using. If I choose any encoding I will be limiting that.

How do I solve that to put the correct encoding for each user.

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:14:59+00:00Added an answer on May 26, 2026 at 12:14 am

    Actually, for C paths, you want something a bit uglier:

    NSString *strPath = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:filename length:strlen(filename)];
    

    And to go the other way:

    const char *cPath = [nsFilename fileSystemRepresentation];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Take this non-compiling code for instance: public string GetPath(string basefolder, string[] extraFolders) { string
I'm compiling some C# and VB code at run time using the CodeDomProvider, CompilerInfo,
Compiling this lines long int sz; char tmpret[128]; //take substring of c, translate in
While compiling code using vim (not gvim) the output looks fine in the terminal
When compiling code with VC++, MSDN gives you the option between using the x86_amd64
When compiling this code I get the following error : In function 'int main()':
When compiling this code I get: fatal error C1083: Cannot open include file: 'fstream.h':
When I am compiling my code I am getting this kinda errors... _OBJC_CLASS_$_ISTAlertView, referenced
I am compiling this code with g++: #include <pthread.h> #include <iostream> #include <cstdlib> #include
I get this warning when compiling my code in VS2008 warning C4275: non dll-interface

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.