QUOTE=Adak;904808]Do you want to run a replaceable filename from the C program, or do you want to run a bat file from the C program, and have the bat file run the filename (again, replaceable...
Type: Posts; User: Tigers!
QUOTE=Adak;904808]Do you want to run a replaceable filename from the C program, or do you want to run a bat file from the C program, and have the bat file run the filename (again, replaceable...
Tabstop
I have tried the following
char DOScommand[50]; //command to be sent to batch file
sprintf(DOScommand, "testing_parse_lines_DOS-2.bat %a", oldrptname);
system(DOScommand);
I don't fully understand what you mean. I am trying to run a batch file and pass a parameter to it (if possible).
What do you mean by 'contains the command'?
Gudday all
Need to call a batch file from C on my Vista or XP machine (but the code will eventually go on a Win2003/2007 machine).
Searching through the forums found a few previous threads which...
status = rename("error.dat", oldrptname);
if (status != 0)
{
perror("problem is:");
}
else {
printf("No error found\n");
}
The error message is : File exists.
Here is my sophisicated error checking. Can we find out what the error actually is?
int status;
status = rename("error.dat", oldrptname);
if (status != 0)
{
printf("error found\n");...
Seems too simple. Only combination I didn't try. I will edit and run.
:eek: Damn. No apparent change e.g. error.dat is still called error.dat. It works though if I give a name with quotes in...
Thanks spidey
The next problem I have is to rename an existing file that I have created with my code with the original filename using the rename function.
char oldrptname[22]; //name of last...
Gudday all
The biggest error I get with my C programming is incompatible assignment types of various flavours. In this case it is strings.
char rptline[30]; //name of RPT file
const...
I meant search the C programming forum for how to include either batch files or DOS commands in C code.
A google search is so comprehensive that the wheat is drowned in the chaff :eek:
Can batch...
After a bad night's sleep :( and some more thought I will use DOS to do the file moving/copying/deleting as it does seem much cleaner (and easier).
I have had a look through the threads for ways...
do you mean that we should let the OS handle such opeartions? Doesn't that raise portability issues?
Or do you mean something else?
I am writing code that will be used on Win2003 server and XP machines (at least at present).
Is SHFileOperation() a Win command rather than a C command? I am trying to avoid being that specific due...
Oh dear now you have me thinking.
My 1st reaction is that the copy function is also being used to move TIFF files. Admittedly I have not checked the TIFF files to see if they are different.
But you...
(I am so close to finishing my 1st large C programme for my new boss I can almost taste it, yet errors crop up)
I have written a small C function to copy/move files from one location to another...
C_nuta
Thank you for your reply.
I have made your suggestions and and getting a compliation error.
error: invalid conversion from `void*' to `char*'
in the line
char *tiffUrl= malloc(100);...
Gudday all
Still trying to finish my 1st large (for me anyway) C program at work. Slwoly getting rid of the bugs and errors. Presently I have a situation where variable is being changing to a...
Sebastiani
In an earlier thread you showed me the sstrncpy and I have used it in my code. it works well. I will try the sstrncat.
Et al
I found an error earlier in the code. Having a lower case letter rather than an upper case can pose problems.
Thank you for your replies.
(Sorry if the title does not really match the question.)
I have been hardcoding filenames into my code but have been told that that is error prone and hard to maintain.
I have tried to recode to...
Gudday all
The code below is a little one I wrote to left shift the string src one char to the left to remove the leading '\'
Strings have proved suprisingly difficult for me to regrasp after years...
Oh I have used those before.
Strings have been a thorn in my side these last 3 months. Trying to remember when a \n is added and when it is not. Trying to remember when \0 should be there or not.
...
Now you have me worried as to what I am missing or have missed.
I learnt/used C many years ago at uni. Trying to catch up again is proving to be a long process.
Your comment about the string not containing '\' puzzles me. How then is a '\' expressed if it looks like a '\0'?
How does C differentiate between a '\' and a '\0'?
Gudday all
I wish to left shift a string by one char to remove a leading '\'. In concept it seems simple enough but I flounder on the strings handling still esp. initialisation, pointers etc:
...