How can I convert a relative path to an absolute path in C on Unix?
Is there a convenient system function for this?
On Windows there is a GetFullPathName function that does the ... |
Is there a way to retrieve path information from a file descriptor or FILE pointer?
I'm aware that this data may not always be relevant/useful for case where the file descriptor ... |
On Windows, you can go to "Run," type in "cmd," press enter, and start up "C:\Windows\system32\cmd.exe" rather easily. The same is true for "python" or "pythonw" (though nothing pops up in ... |
I just installed Emacs Speaks Statistics, which is when this error started showing up. Uninstalling hasn't fixed it.
When I use C-x C-f, I can navigate normally, but when I actually press ... |
Suppose I have a file path as C:\Sample\example.txt.
how can full path of the file be retrieved (the file can be in any directory) just by giving the filename i.e., example.txt ... |
So the final part I'm missing in my assignment is a way to print ONLY the file names (rather than ./usr/etc/folder/directory/file.pdf, I want to print file.pdf) but I can't remember how ... |
Is there a way I could get the inode number of a file which has not yet been opened. I would like to do this from inside a c function
Regards,
Lipika
|
|
FILE *fp;
fp=fopen("c:\\test.txt", "r");
int fgetc (FILE *fp);
int fputc( int c, FILE *fp );
Is there any way to change a filename that already exist in computer?
If yes, then how should i reference the ... |
I'm working on crossplatform library which will be used to file manipulations (create, rename, delete, ...) on optical media. So I have questions related to path handling.
- Currently I have no ...
|
|
|
Hey all, I'm writing a c++ program that needs to read a file. I'm trying to read a file that is in the same directory as the executable. Everything works fine if I execute the program while in the program's directory. What I need to do is read that file regardless of where (cwd) I execute the program from, without hardcoding ... |
|
|
hi ilikepython, im not getting this c_str()function im not good at this pointer things can u tell me a little more abt y r u implying this here.. if possible? by the way cstring is not working with my c++ compiler as it is for visual c++ i hope!!! That function turns a string object into a char array. That is ... |
|
Hello, i am writing a program and i want to read from a file and create another and write to it, i already have most of it figured out but my problem is the file path, i cant create it to C:\ as it gives issues so i create them at C:\Users\[my username]. how can i get the program to get ... |
I need to create , open , write and save soenthing to a text file in a specific folder. At the moment i am doing this : ------------------------ FILE *OutFile = fopen("Test.txt","w"); fprintf(OutFile,"This is a test to open,write and save something to a sig file"); fclose(OutFile); ------------------------------------------- This opens and saves the txt file in the project folder. I need it ... |
|
|
|
Hey, every one. I have a (hopefully) quick question here, and I'd appreciate any help you can offer. I really need to be pointed in the right direction here. Hopefully I can explain this clearly: I'm trying to write a program where you can insert the path of a file (C:\Program Files\CProgrammingRocks.txt as an example), and it'll look for a certain ... |
#include #include #include #include #include int main ( ) { struct stat sb; if ( stat("c:/temp/xfiles.txt", &sb ) == 0 ) { printf("DOS Forward slash size = %lu\n", sb.st_size ); } if ( stat("c:\\temp\\xfiles.txt", &sb ) == 0 ) { printf("DOS Backward slash size = %lu\n", sb.st_size ); } if ( stat("/cygdrive/c/temp/xfiles.txt", &sb ) == 0 ... |
As been pointed out a relative path is always relative to the current working directory and not to the location of the executable. So if you store your resources relative to the location of the executable you have to have a means to find out where your executable is stored. One way to get that location is to check the commandline ... |
|
|
ok.....from the standard escape table i see.... \n -----new line charater dir\no.txt" ----so creating trouble.... and also in my above post c:\\fold\\vol\\ file.txt there was \f-----> form feed \v-----> vertical tab these are also in the escape sequence table. so effectively if i really need a sigle slash( which is like in DOS) i have to use one more slash(to override?) ... |
When I need to use a data file I'll put it in the preprocessor directives: #include FILENAME "c:\datafile.dat" Is there a way of assigning FILENAME to some user defined file name? In other words, I would like to: printf ("Enter the path of your data file =>"); and somehow associate this entry with FILENAME. I've tried playing around with some string ... |
I would like to know how to find out what the directory path of a running program is. The intention being, that if I distrubute a small zipped program to some friends with a preset file and folder structure for the program to save files too, how can I get the program to find out where it has been unzipped too ... |
|
public string scanFile(string filePath) { try { /****** ERROR IS THROWN LINE BELOW ******/ TextReader reader = new StreamReader(filePath); string line = ""; while ((line = reader.ReadLine()) != null) { .....do lots of stuff } if (yada yada) { return report; } else { return null; } } catch (Exception e) { throw e; } } |
Hi all, thanks for your input. these forums are invaluable for newbies like me just starting out in the programming world. I managed to solved the problem which was so simple it's almost embarrassing. I had the filename as actors.txt.txt so obviously that wouldn't work. when changed to actors.txt it worked fine. still don't have any idea what the while(true) is ... |
33. File path forums.devshed.com |
|
I have a linux C program which takes as input a filename, the filename can include the full path to it or it can be relative from the current directory where the program is being run. What I need to do is if given a relative path, I need to turn it into a full path and store that string for ... |
36. file path forums.devshed.comhi, i'm using static path in my c application for the accessing of batch file ,but i want to use the relavent path of the file . how can i do that ? char filePath[]= "H:\\project\\data\\STOCK786.dat"; /* path of the DAT File */ path of this c file= "H:\\project\\source\\STOCK786.dat"; so i want to access that "dat" file in this c file ... |
im trying to make a program that i can choose the an xml i want to open and then convert it from acsii to hex then write that to a file I havent gotten to the hex part just yet I am still working on the file selecting part. help on any of it would be great im new to this ... |
|
What I need to know is if in the following code I need to set a path to files, i.e. /path/to/users.dat. I am a self taught programmer and mainly deal with PHP and CFML with MySQL and not C++. This is designed for a unix based system and designed to compile using g++. It updates the backend to an online game ... |
|
|
"Ronald S. Cook" > "PS" "Ronald S. Cook" news:%23XHe%23KeYHHA.984@TK2MSFTNGP04.phx.gbl.. . >>I'm trying to see if a file exists on a server. I have the below code >>which doesn't seem to work. Must I necessarily have a mapped drive to >>that the path ... |