473,471 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Convert a file's name into a string - C Program

13 New Member
Hello there, can i ask if there is a way to convert a file's name into a string.

Sample:

filename = testcode.txt

it will convert the file's name into a string:

char convert[100];

covert = name of file

Is this possible?

Thank you guys ;_;

Regards,
AnimeProgrammer
Feb 18 '14 #1
3 2420
weaknessforcats
9,208 Recognized Expert Moderator Expert
I'm not sure what the question is considering that a file name is already a string.

Expand|Select|Wrap|Line Numbers
  1. const char filename[] = "testcode.txt";
Feb 18 '14 #2
animeprogrammer
13 New Member
sorry, i guess i didn't made it create,

Example is i have a file, a text file that is. It's file name is textfile.txt

How can i convert that filename into a string.
Feb 19 '14 #3
Banfa
9,065 Recognized Expert Moderator Expert
Do you mean how can you read the file names in a specific directory without knowing ahead of time what files are in the directory? If so we would need to know what platform you are using because the solution is platform specific.

In any other case the file name would be supplied somehow, hard coded into the program, supplied on the command line, given as input by the user to the program. In all these cases the file name would, of necessity, have to already be a string.
Feb 19 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Swarup | last post by:
I am reading a file (txt, xml, gif, ico, bmp etc) byte by byte and filling it into a byte arry. Now i have to convert it into a string to store it in the database. I use...
15
by: Coca | last post by:
HI, all How can I convert the C6.0 program of OS/2 platform TO windows2000/xp platform. The program occurs a lot of errors in Windows 2000/xp when compiled. And I hope a quick way to solve...
8
by: FrzzMan | last post by:
How to convert back a string that have converted to byte using System.Text.Encoding.UTF8.GetBytes() string StringData = "This is a string"; byte ConvertedString =...
5
by: moondaddy | last post by:
How do I get the string representation of an int? for example int var1 = 2; string var2 = var1.ToString; I'm wanting var2 to be "2" I get the compile error: Error 1 Cannot convert...
0
by: Ayman | last post by:
Hi All, I develop an application to send fax using Dialogic card. I have to convert any file need to be sent to tiff file. I can convert any image file to tiff, but I would like to know how to...
3
by: bussiere maillist | last post by:
i've got a very long string and i wanted to convert it in binary like string = """Monty Python, or The Pythons, is the collective name of the creators of Monty Python's Flying Circus, a British...
8
by: =?Utf-8?B?UmljYXJkbyBRdWludGFuaWxsYQ==?= | last post by:
i need to convert data from string to nibble wich (nibble is a four bits representation) As example i have the following code string data1 = "12345678"; so ¿how can i convert this data...
21
by: Aman JIANG | last post by:
hi I need to do this (convert double to string) fast, safe and portable. Is there any way to do this ? Except the ways following: 1. C++ I/O stream, stringstream (and boost::lexical_cast) 2....
3
by: mamul | last post by:
Hi please some one can help me. how to convert char * to string? i have take char *argv from command line and want to pass to a function as string object(string str) i want to first convert argv...
6
by: tig2810 | last post by:
Hi all This sounds easy and I'm sure it is but i'm just having so much trouble. I have a directory with text files. I want to search the text files for a string and return the name of the file that...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.