Reputation: 1181
I'm having trouble understanding what this line of code does:
sprintf(obj, "%s.o", root);
obj and root are both character buffers, from what I read root is basically copied to obj? I'm not sure what "%s.o" is doing. %s is to specify a String but the .o?
thanks for any help
Upvotes: 1
Views: 1500
Reputation: 59297
The %s
will be replaced with the contents of root
, and followed by the .o
part of the string, which is just an "additional" text. For example, if root
has "file", obj
will be set to "file.o".
Upvotes: 6