Click here to Skip to main content
15,911,891 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow do I know status of a service in a remote machine ? Pin
SherTeks20-Feb-09 19:00
SherTeks20-Feb-09 19:00 
AnswerRe: How do I know status of a service in a remote machine ? Pin
«_Superman_»20-Feb-09 19:52
professional«_Superman_»20-Feb-09 19:52 
GeneralRe: How do I know status of a service in a remote machine ? Pin
SherTeks20-Feb-09 20:10
SherTeks20-Feb-09 20:10 
QuestionError Creating Device Enumerator....... Pin
shaina223120-Feb-09 16:47
shaina223120-Feb-09 16:47 
AnswerRe:Solution for Error Creating Device Enumerator....... Pin
shaina223120-Feb-09 18:27
shaina223120-Feb-09 18:27 
QuestionUgly C code Pin
meixiang620-Feb-09 13:16
meixiang620-Feb-09 13:16 
GeneralRe: Ugly code Pin
Luc Pattyn20-Feb-09 14:27
sitebuilderLuc Pattyn20-Feb-09 14:27 
AnswerRe: Ugly C code Pin
grzkas22-Feb-09 1:30
grzkas22-Feb-09 1:30 
You should really use sprintf() instead of strcpy and strcat, it will look something like this:

sprintf(pro, "%s%s%s%s%c%s%s%s%c%s%s%s%s",
"qsub -P ",
argv[2],
" -wd -e ",
cwd, '/',
str,
".error -b y /usr/local/projects/bin/program -i ",
cwd,
'/',
str,
" -type p -terms -lookup -o ",
str,
".qsub");

after this call pro[] buffer contains formatted string Smile | :)

And few remarks about your code safety:
be careful with creating huge local buffers on the stuck - pro[] buffer in this case. It may happen that you get stuck overflow (application crush) It is better to create such buffers dynamically then you can check if allocation succeeded or just create static buffer

use sizeof(str) in fgets(str, sizeof(str), f) to avoid problems with writing outsie str[] memory area when str[] buffer size will be changed to smaller one
GeneralRe: Ugly C code Pin
meixiang622-Feb-09 6:12
meixiang622-Feb-09 6:12 
GeneralRe: Ugly C code Pin
Stuart Dootson22-Feb-09 13:54
professionalStuart Dootson22-Feb-09 13:54 
GeneralRe: Ugly C code Pin
meixiang622-Feb-09 16:25
meixiang622-Feb-09 16:25 
QuestionSending mp3/pcm sample as payload Pin
septane20-Feb-09 6:39
septane20-Feb-09 6:39 
AnswerRe: Sending mp3/pcm sample as payload Pin
led mike20-Feb-09 8:32
led mike20-Feb-09 8:32 
GeneralRe: Sending mp3/pcm sample as payload Pin
septane20-Feb-09 18:12
septane20-Feb-09 18:12 
AnswerRe: Sending mp3/pcm sample as payload Pin
«_Superman_»20-Feb-09 15:49
professional«_Superman_»20-Feb-09 15:49 
QuestionGetProcAddress() question.... Pin
Member Ártemis20-Feb-09 6:00
Member Ártemis20-Feb-09 6:00 
QuestionRe: GetProcAddress() question.... Pin
David Crow20-Feb-09 6:21
David Crow20-Feb-09 6:21 
AnswerRe: GetProcAddress() question.... Pin
Member Ártemis20-Feb-09 7:17
Member Ártemis20-Feb-09 7:17 
GeneralRe: GetProcAddress() question.... Pin
David Crow20-Feb-09 7:23
David Crow20-Feb-09 7:23 
QuestionRe: GetProcAddress() question.... Pin
CPallini20-Feb-09 6:28
mveCPallini20-Feb-09 6:28 
AnswerRe: GetProcAddress() question.... Pin
Member Ártemis20-Feb-09 7:22
Member Ártemis20-Feb-09 7:22 
GeneralRe: GetProcAddress() question.... Pin
Mark Salsbery20-Feb-09 8:29
Mark Salsbery20-Feb-09 8:29 
GeneralRe: GetProcAddress() question.... Pin
led mike20-Feb-09 8:31
led mike20-Feb-09 8:31 
GeneralRe: GetProcAddress() question.... Pin
Mark Salsbery20-Feb-09 8:36
Mark Salsbery20-Feb-09 8:36 
GeneralRe: GetProcAddress() question.... Pin
led mike20-Feb-09 8:43
led mike20-Feb-09 8:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.